Dyed Wool

Discussion in 'Plugin Development' started by MaxNatural, Feb 21, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    MaxNatural

    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("");
                       
                           
                        }
     
  2. Offline

    Lilret123

    @MaxNatural
    Is there an error?

    also try it like this

    if(clicked.getType().equals(Material.WOOL)){

    //codes

    }
     
  3. Offline

    MaxNatural

    @Lilret123 No it works but can you check for the colored wool? Not just white wool.
     
  4. Offline

    Lilret123

  5. Offline

    MaxNatural

  6. Offline

    mine-care

    @MaxNatural read docs of Material class and you'll find how =)
    Also you could compare itemstacks like clicked with a itemstack of red wool :p

    PLEASE! fix this:
    Player p = (Player) sender;
    (in your signature, Read mine to find what's wrong :p)
     
  7. Cleaned up thread, please keep on-topic
     
Thread Status:
Not open for further replies.

Share This Page