Removing Custom Named items

Discussion in 'Spigot Plugin Development' started by PracticalX, May 13, 2017.

  1. Hello! Currently my code does not work, I'm trying to make it so whenever I right-click a book named Unique Enchantment Book, it runs a code.. But if its a normal book it does not..

    This currently does not work, its my code..

    Code (Text):
            public void onPlayerUse(PlayerInteractEvent event){
                Player p = event.getPlayer();
                  ItemStack i = p.getItemInHand();
                  ItemMeta im = i.getItemMeta();
                  if (im.getDisplayName().equalsIgnoreCase("§e§lUnique Enchant Book")) {
  2. Did you register the listener? Or does the event even fire?

    May after you remove the item use p.updateInventory()
  3. And may just use p.setItemInHand(null); should work too
  4. Yes, listeners are implemented, and I changed it to null :D