Solved Let anti grief plugins have priority over my plugin

Discussion in 'Plugin Development' started by fireboyev, Dec 11, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    fireboyev

    Hey all,
    I have this plugin that when you mine it puts the drops into your inventory instead of dropping, but the problem is that my plugin bypasses grief protection plugins so I'm wondering if I can let anti grief have priority over my plugin or do I have to implement an API for every plugin out there?
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    fireboyev

    I Checked if the event was canceled but still it is getting triggered, but I am getting the message from the antigrief plugin still which is world guard.
    here is my code:
    Code:
        @EventHandler(priority = EventPriority.LOWEST)
        public void onBlockBreak(BlockBreakEvent event) {
            if (!event.isCancelled()) {
                Player player = event.getPlayer();
                if (InviMiner.map.containsKey(player)
                        || InviMiner.plugin.getConfig().getBoolean("enabledbydefault") == true) {
                    Block block = event.getBlock();
                    PlayerInventory inv = player.getInventory();
                    for (ItemStack item : block.getDrops()) {
                        if (inv.firstEmpty() > -1) {
                            inv.addItem(item);
                        } else {
                            block.getWorld().dropItemNaturally(block.getLocation(), item);
                        }
                    }
                    block.setType(Material.AIR);
                }
            }
        }
    -EDIT-

    I set the EventPriority to highest and it works now!
     
  4. Offline

    Zombie_Striker

    @fireboyev
    Yep. Lowest means load first, not load later.

    If your problem has been solved, mark this thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page