use of org.anhcraft.spaciouslib.inventory.InteractItemRunnable in project SpaciousLib by anhcraft.
the class InteractItemListener method interact.
@EventHandler(priority = EventPriority.MONITOR)
public void interact(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
Inventory inventory = CompatibilityInventoryClickEvent.getInventory(event);
ClickType type = event.getClick();
if (inventory != null && data.containsKey(inventory)) {
event.setCancelled(true);
event.setResult(Event.Result.DENY);
ItemStack item = event.getCurrentItem();
if (item != null && !item.getType().equals(Material.AIR) && data.get(inventory).containsKey(item)) {
LinkedHashMap<ItemStack, InteractItemRunnable> items = data.get(inventory);
items.get(item).run(player, item, type, event.getSlot());
data.put(inventory, items);
}
}
}
Aggregations