Public on Interact help for newbies <3

Discussion in 'Plugin Development' started by XexCruz, May 23, 2017.

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

    XexCruz

    Code:
    ItemStack[] contents = player.getInventory().getContents();
    
    for (int i = 0; i < contents.length() ; i++)
    {
      Itemstack item = contents[i];
      //your code
    }
    Add this then your code
     
    Last edited: May 31, 2017
  2. Offline

    Caderape2

    @XexCruz
    - The item in the player'hand can be null
    - An item might not have itemMeta or lore, so you have to check it first.
    - You're trying to set an int to a variable itemstack
    - You for loop cannot work too.
     
  3. Offline

    XexCruz

    @Caderape2 I am kind of understanding what you're talking about, I have the itemMeta and the lore ready its just Itemstack is the only one that is bothering me
     
  4. Offline

    Caderape2

    @XexCruz
    As i said,
    You're trying to cast an int, the contents length, to an itemstack.
    Same here
    you should do something like this
    Code:
    ItemStack[] contents = player.getInventory().getContents();
    
    for (int i = 0; i < contents.length() ; i++)
    {
      Itemstack item = contents[i];
      //your code
    }
     
Thread Status:
Not open for further replies.

Share This Page