So in a inventory i'm checking if the player clicked the colored wool but I tried so many different ways and it doesn't work. Code: public class ClickListener implements Listener { @EventHandler public void onClick(InventoryClickEvent event){ HumanEntity entity = event.getWhoClicked(); if ((entity instanceof Player)){ Player player = (Player)entity; if (event.getInventory().getName().equals(CompassPort.getCompassInventory().getName())){ event.setCancelled(true); ItemStack clicked = event.getCurrentItem(); if (clicked!=null){ if (clicked.getType()==Material.WOOL){ player.closeInventory(); player.performCommand(""); }
@MaxNatural Is there an error? also try it like this if(clicked.getType().equals(Material.WOOL)){ //codes }
@MaxNatural read docs of Material class and you'll find how =) Also you could compare itemstacks like clicked with a itemstack of red wool PLEASE! fix this: Player p = (Player) sender; (in your signature, Read mine to find what's wrong )