Solved Solved

Discussion in 'Plugin Development' started by coolmonkeyguy, Mar 14, 2014.

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

    coolmonkeyguy

    Hi I've been having trouble removing an item when a user right clicks it. Here is the code...

    Code:java
    1. if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction().equals(Action.RIGHT_CLICK_AIR)) {
    2. if (e.getPlayer().getItemInHand().getType().equals(Material.SUGAR)) {
    3. e.getPlayer().sendMessage(ChatColor.BLUE + "[" + ChatColor.LIGHT_PURPLE + "BBContraband" + ChatColor.BLUE +"]" + " " + ChatColor.WHITE + "Enjoy That Cocaine..." );
    4. e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED ,700,2));
    5. e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING ,700,2));
    6. }
    7. }


    Basically when the player right clicks the sugar in his inventory that item stack should go down 1 item. How would I do this? Could someone implement it into my code?
     
Thread Status:
Not open for further replies.

Share This Page