Get the first item from the inventory

Discussion in 'Plugin Development' started by FlingeR, Apr 6, 2011.

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

    FlingeR

    Here my code, the idea is to find the first item from the inventary of a player "p1":

    Any idea why is this crashing the clients ? xD
     
  2. Offline

    ssell

    @FlingeR

    Its late, and my brain is frazzled from working on caches, but I believe the ItemStack returned by getContents() is created in order.

    By this I mean that the first item in the inventory will be the first in the stack, and also the last item in the inventory is the last item in the stack.

    Then if you need to find the actual slot, you can do first( firstItemInStack.getType() ).
     
  3. Offline

    FlingeR

    It seems that the empty slots of the inventory have "AIR", so i cant ask for a null value.
     
Thread Status:
Not open for further replies.

Share This Page