InventoryClickEvent problem and canceling runnable if player moves or drops the item?

M

MrAndeos

Guest
#1
Hello.

I wrote this simple class, that checks if player moved blaze rod to one of it's hotbar slots, if so, its starting the runnable that applies INCREASE_DAMAGE effect to player:

Code:

private int taskId;

@EventHandler
public void onInteract(InventoryClickEvent event) {
final Player player = (Player) event.getWhoClicked();
for(int i = 0; i < 9; i++) {
if(event.getSlot() == i) {
if(event.getCurrentItem().getType() ==...
InventoryClickEvent problem and canceling runnable if player moves or drops the item?