Hey! I have the following code, however what method do I employ to make it so that if the name of the chest is "Wardrobe", then you do the code I have said. Code:java public class InteractListener implements Listener { @EventHandler public void onClick(PlayerInteractEvent event) { Player player = event.getPlayer(); Action action = event.getAction(); if (action == Action.RIGHT_CLICK_BLOCK || action == Action.RIGHT_CLICK_AIR) { ItemStack hand = player.getItemInHand(); if (hand != null && hand.getType() == Material.CHEST) { player.sendMessage(ChatColor.GOLD + "Opening Wardrobe selector..."); player.openInventory(CompassPort.getCompassInventory()); event.setCancelled(true); } } } } Thanks, ProMCkingz
Gerov Lol sorry, Code:java public class InteractListener implements Listener { @EventHandler public void onClick(PlayerInteractEvent event) { Player player = event.getPlayer(); Action action = event.getAction(); if (action == Action.RIGHT_CLICK_BLOCK || action == Action.RIGHT_CLICK_AIR) { ItemStack hand = player.getItemInHand(); if (hand != null && hand.getType() == Material.CHEST) { player.sendMessage(ChatColor.GOLD + "Opening Wardrobe selector..."); player.openInventory(CompassPort.getCompassInventory()); event.setCancelled(true); } } } }
ProMCKingz Well, if you are wondering how to get ItemMeta, you first check if: Code:java ITEMSTACK_OBJECT.getItemMeta.getDisplayName() != null; And then you do what you want with the displayName of the object.