Null pointer

Discussion in 'Plugin Development' started by coby9, Jun 15, 2014.

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

    coby9

  2. Offline

    Antybarrel

    You have Player player = null. Thats your issue because null pointer means somethings null.
    Change to Player p = (Player) sender;
     
  3. Offline

    amhokies

    coby9
    Or instead of initializing your Inventory object "i" outside of the if statement, do so after you assign a value to player that isn't null.
     
  4. Offline

    coby9

    If I do that all the "player" then error out
     
  5. Offline

    Antybarrel

    Change to Player player = (Player) sender;
     
  6. Offline

    coby9

    THANK YOU SO MUCH
     
  7. Offline

    amhokies

    coby9
    You need to make sure to check that sender is instance of Player as well.
     
  8. Offline

    coby9

    Okay so heres my code,How would I make it say "you have that already" if they have the book when they type the command
     
Thread Status:
Not open for further replies.

Share This Page