checking if an inventory slot is equal to something

Discussion in 'Plugin Development' started by thechrisanator, Nov 16, 2018.

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

    thechrisanator

    this error happens when I print this.

    http://prntscr.com/lja012

    Code:
    System.out.println("x");
                                                    System.out.print(toolinv.get(player.getUniqueId()).getItem(1).getType());
    am I not doing this right?
     
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    thechrisanator

    how do I check if getItem will return null?
    I've figured out if (toolinv.containsKey(player.getUniqueId())), but I'm not sure about getItem

    is it just if getitem != null?
     
  4. Offline

    Zombie_Striker

    @thechrisanator
    if(...getItem(1) == null){
    // Item is null. Don't do anything with it.
    }
     
Thread Status:
Not open for further replies.

Share This Page