Question Remove bottle after Potion use

Discussion in 'Bukkit Help' started by Sponge1525, Nov 22, 2015.

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

    Sponge1525

    Hello community,

    I am a relative beginner when it comes to java programming and have recently gotten into creating bukkit plugins, but I have recently run into a challenge: Removing the bottle after drinking a potion.

    I wrote this short piece of code:
    Code:
    @EventHandler
    public void emptyestus(PlayerItemConsumeEvent e)
    {
        Player player = e.getPlayer();
        if(e.getItem().getType() == Material.POTION);
        {
            player.getInventory().removeItem(new ItemStack(Material.GLASS_BOTTLE));
        }
    }
    but its a bit buggy. It will leave behind a bottle when I drink the first and last potion of a stack of potions.

    What can I do to fix this or is there an alternate way to write this?
     
    Last edited: Nov 22, 2015
Thread Status:
Not open for further replies.

Share This Page