Consumables can now swap places with normal items

This commit is contained in:
Indyuce 2020-08-23 15:27:20 +02:00
parent a34ba330b0
commit 5ff232a48e

View File

@ -270,11 +270,11 @@ public class ItemUse implements Listener {
event.setCurrentItem(result.getResult());
}
if (useItem instanceof Consumable && event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR) {
event.setCancelled(true);
if (((Consumable) useItem).useOnItem(event, MMOLib.plugin.getVersion().getWrapper().getNBTItem(event.getCurrentItem())))
if (useItem instanceof Consumable && event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR)
if (((Consumable) useItem).useOnItem(event, MMOLib.plugin.getVersion().getWrapper().getNBTItem(event.getCurrentItem()))) {
event.setCancelled(true);
event.getCursor().setAmount(event.getCursor().getAmount() - 1);
}
}
}
@EventHandler