Solved Check if item is moved into an stack?

Discussion in 'Plugin Development' started by All_Fire69, Jan 25, 2015.

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

    All_Fire69

    Hey guys, by reading the title it's pretty obvious what I need help with. Basically, I'm coding a plugin where if someone moves a bowl into their inventory in a certain amount of time, it will send an alert. But, I can't even seem to get when a player moves a bowl into their inventory. Any help?
    Code:
    if(e.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY){
                     int bowls = 0;
                        for (ItemStack itemStack : p.getInventory().getContents()) {
                          if ((itemStack != null) &&
                            (itemStack.getType() == Material.BOWL)) {
                            bowls += itemStack.getAmount();
                          }
                        }
                    if(bowls > 5){
                        Bukkit.broadcastMessage("test");
                }
            }
    I'm a noob, forgot to register events. :/

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
Thread Status:
Not open for further replies.

Share This Page