Remove Item On Right Click

Discussion in 'Plugin Development' started by MaxNatural, Jan 10, 2015.

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

    MaxNatural

    What I want is when you right click a Golden Apple it removes it out of your inventory.
     
  2. Offline

    1Rogue

    What have you tried so far?
     
  3. Offline

    teej107

    Sounds like a plugin request to me.
     
    ChipDev likes this.
  4. Offline

    Krizeh

    Code:
      @EventHandler
      public void onClick(PlayerInteractEvent e) {
          Player p = e.getPlayer();
          if (p.getItemInHand().getTypeId() == 322) {
          if (e.getAction().equals(Action.RIGHT_CLICK_AIR) || (e.getAction().equals(Action.RIGHT_CLICK_BLOCK))) {
              e.setCancelled(true);
                  p.getInventory().remove(p.getItemInHand());
              }
          }
      }
     
    Vextricity likes this.
Thread Status:
Not open for further replies.

Share This Page