Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onInteract(PlayerInteractEvent event) {
- if(event.getAction() == Action.RIGHT_CLICK_BLOCK)
- {
- Block block = event.getClickedBlock();
- if (block.getType() == Material.CHEST) {
- Chest chest = (Chest) block.getState();
- /* Тут, если надо - выполнить проверку на то имеет ли игрок доступ к сундуку,
- * иначе мы позволим открывать запротекченные сундуки */
- if(access)
- {
- event.getPlayer().openInventory(chest.getBlockInventory());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment