Plugin Help ItemStack Issues...

Discussion in 'Plugin Help/Development/Requests' started by redtsch, May 27, 2016.

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

    redtsch

    Hello Bukkit.

    I'm working on a project right now that makes a piece of paper with the name "§eBandage", when you right click it, you receive 1 heart of health back. It works, but not when there are multiple of the items in a stack. how can i fix this?

    InteractEvents:
    Code:
    @SuppressWarnings("static-access")
    public class InteractEvents implements Listener {
      
        EzCore core = EzCore.getInstance();
        EzUtils utils = EzUtils.getInstance();
        EzItems items = EzItems.getInstance();
      
        @SuppressWarnings("deprecation")
        @EventHandler
        public void useBandage(PlayerInteractEvent event) {
            Player player = event.getPlayer();
            if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
                if (player.getItemInHand().equals(items.itemsItemsBandage)) {
                    if (player.getHealth() < 20) {
                        player.setHealth(player.getHealth() + 1);
                        player.playSound(player.getLocation(), Sound.BLOCK_NOTE_PLING, 1.0F, 1.0F);
                        player.getInventory().removeItem(items.itemsItemsBandage);
                        player.updateInventory();  
                    } else {
                        return;
                    }
                }
            }
        }
    }
    
    All help is appreciated, PLEASE let me know if I've been vague or if you need more info on anything =P
     
Thread Status:
Not open for further replies.

Share This Page