Skip to content

Custom Events

Alexander Chapchuk edited this page Jul 5, 2021 · 3 revisions

CustomItems support few custom Event for getting your CustomItemStack's at Runtime.

On pickup

Called when Entity pickup the CustomItemStack

@EventHandler
public void onPickup(EntityPickupCustomItemEvent event) {
    AbstractCustomItemStack abstractItemStack = event.getItem().getItemStack();
    //TODO process
}

On drop

Called when Player drop CustomItemStack

@EventHandler
public void onPickup(PlayerDropCustomItemEvent event) {
    AbstractCustomItemStack abstractItemStack = event.getItemDrop().getItemStack();
    //TODO process
}

On clicked in the inventory

Called when Player click at CustomItemStack in the inventory

@EventHandler
public void onPickup(PlayerClickOnCustomItemStackInInventoryEvent event) {
    AbstractCustomItemStack abstractItemStack = event.getCurrentItem();
    //TODO process
}

On fight

Called when Player damage some Entity with the CustomItemStack

@EventHandler
public void onPickup(EntityDamageByPlayerWithCustomItemStackEvent event) {
    AbstractCustomItemStack abstractItemStack = event.getAbstractCustomItemStack();
    //TODO process
}

On interact

Called when Player interact something (AIR/BLOCK) with the CustomItemStack

@EventHandler
public void onPickup(PlayerInteractWithCustomItemStackEvent event) {
    AbstractCustomItemStack abstractItemStack = event.getItem();
    //TODO process
}

Need more?

Just request that in issues

Clone this wiki locally