package com.skelril.aurora;
import com.sk89q.commandbook.CommandBook;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.skelril.aurora.util.ChanceUtil;
import com.skelril.aurora.util.ChatUtil;
import com.skelril.aurora.util.ItemUtil;
import com.zachsthings.libcomponents.ComponentInformation;
import com.zachsthings.libcomponents.Depend;
import com.zachsthings.libcomponents.bukkit.BukkitComponent;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.player.PlayerExpChangeEvent;
import org.bukkit.inventory.ItemStack;

/**
 * Author: Turtle9598
 */
@ComponentInformation(friendlyName = "Custom Items Component", desc = "Custom Items")
public class CustomItemsComponent extends BukkitComponent implements Listener {

    private final CommandBook inst = CommandBook.inst();
    private final Server server = CommandBook.server();

    @Override
    public void enable() {

        //noinspection AccessStaticViaInstance
        inst.registerEvents(this);
    }

    @EventHandler(ignoreCancelled = true)
    public void onXPPickUp(PlayerExpChangeEvent event) {

        Player player = event.getPlayer();

        if (ItemUtil.hasAncientArmour(player)) {
            ItemStack[] armour = player.getInventory().getArmorContents();
            ItemStack is = armour[ChanceUtil.getRandom(armour.length) - 1];
            int exp = event.getAmount();
            if (exp > is.getDurability()) {
                exp -= is.getDurability();
                is.setDurability((short) 0);
            } else {
                is.setDurability((short) (is.getDurability() - exp));
                exp = 0;
            }
            player.getInventory().setArmorContents(armour);
            event.setAmount(exp);
        }
    }

    @EventHandler
    public void onEntityDeath(EntityDeathEvent event) {

        LivingEntity damaged = event.getEntity();
        Player player = damaged.getKiller();

        if (player != null) {

            World w = player.getWorld();
            Location pLocation = player.getLocation();

            if (ItemUtil.hasMasterBow(player) && !(damaged instanceof Player) && event.getDrops().size() > 0) {

                for (ItemStack is : event.getDrops()) {
                    if (is != null) w.dropItemNaturally(pLocation, is);
                }
                event.getDrops().clear();
                ChatUtil.sendNotice(player, "The Master Bow releases a bright flash.");
            }
        }
    }
}

@@ -21,16 +21,17 @@
 aurora;%0A
+%0A
 import c
@@ -68,115 +68,8 @@
 ok;%0A
-import com.sk89q.minecraft.util.commands.Command;%0Aimport com.sk89q.minecraft.util.commands.CommandContext;%0A
 impo
@@ -252,53 +252,8 @@
 on;%0A
-import com.zachsthings.libcomponents.Depend;%0A
 impo
@@ -410,29 +410,27 @@
 kit.
-command.CommandSender
+entity.LivingEntity
 ;%0Aim
@@ -452,17 +452,22 @@
 .entity.
-*
+Player
 ;%0Aimport
@@ -522,24 +522,29 @@
 t.event.
-Listener
+EventPriority
 ;%0Aimport
@@ -565,40 +565,16 @@
 ent.
-entity.EntityDamageByEntityEvent
+Listener
 ;%0Aim
@@ -1173,16 +1173,50 @@
 Handler(
+priority = EventPriority.MONITOR, 
 ignoreCa
@@ -1964,16 +1964,50 @@
 tHandler
+(priority = EventPriority.MONITOR)
 %0A    pub

Fix priority issue with Custom Items