use of com.bgsoftware.wildchests.api.objects.chests.Chest in project WildChests by BG-Software-LLC.
the class InventoryListener method onChestOpen.
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onChestOpen(PlayerInteractEvent e) {
if (e instanceof LinkedChestInteractEvent || e.getAction() != Action.RIGHT_CLICK_BLOCK || e.getClickedBlock().getType() != Material.CHEST)
return;
if (buyNewPage.containsKey(e.getPlayer().getUniqueId())) {
e.setCancelled(true);
return;
}
Chest chest = plugin.getChestsManager().getChest(e.getClickedBlock().getLocation());
if (chest == null)
return;
plugin.getNMSInventory().updateTileEntity(chest);
chest.onOpen(e);
}
use of com.bgsoftware.wildchests.api.objects.chests.Chest in project WildChests by BG-Software-LLC.
the class InventoryListener method onChestInteract.
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onChestInteract(InventoryClickEvent e) {
Inventory clickedInventory = e.getView().getTopInventory();
if (!(clickedInventory instanceof CraftWildInventory))
return;
Chest chest = ((CraftWildInventory) clickedInventory).getOwner();
chest.onInteract(e);
}
Aggregations