use of com.playmonumenta.scriptedquests.quests.InteractableEntry.InteractType in project scripted-quests by TeamMonumenta.
the class InteractablesListener method inventoryClickEvent.
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void inventoryClickEvent(InventoryClickEvent event) {
if (!(event.getWhoClicked() instanceof Player)) {
return;
}
Player player = (Player) event.getWhoClicked();
ItemStack item = event.getCurrentItem();
ClickType type = event.getClick();
InteractType interactType = null;
switch(type) {
case RIGHT:
interactType = InteractType.RIGHT_CLICK_INVENTORY;
break;
case LEFT:
interactType = InteractType.LEFT_CLICK_INVENTORY;
break;
default:
break;
}
if (item == null || item.getType() == Material.AIR || interactType == null) {
// No point continuing
return;
}
if (item != null && !item.getType().isAir() && player.getCooldown(item.getType()) > 0) {
/* Player's item is on cooldown, don't use it to interact to trigger interactions */
return;
}
if (mPlugin.mInteractableManager.clickInventoryEvent(mPlugin, player, item, interactType)) {
event.setCancelled(true);
}
}
Aggregations