Solved Get if player is putting a creeper head on

Discussion in 'Plugin Development' started by the_merciless, Mar 2, 2013.

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

    the_merciless

    How do i test if the item placed in the helmet slot is a creeper head


    Code:
    @EventHandler (priority = EventPriority.HIGHEST)
        public void oninvclick(InventoryClickEvent e){
            Player p = (Player) e.getWhoClicked();
            if (!p.getWorld().getName().equalsIgnoreCase("world")){
                if (plugin.getClass(p).equalsIgnoreCase("creeper")){
                    if (e.getSlotType() == InventoryType.SlotType.ARMOR && e.getSlot() == 39){
                        ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short)4);
                        if (e.getCursor() == skull){
                            p.sendMessage("Nice hat!");
                        }
                    }
                }
            }
        }
    The problem is at this line

    Code:
        if (e.getCursor() == skull){
    nvm, i had to use .equals instead

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  2. Offline

    kreashenz

    the_merciless make sure, if you solve it, you set the prefix to SOLVED. Thanks you :)
     
Thread Status:
Not open for further replies.

Share This Page