Solved Sign interact null pointer exception

Discussion in 'Plugin Development' started by joeygallegos, Apr 22, 2014.

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

    joeygallegos

    So I created a plugin to interact with custom signs. For some reason I keep getting a null pointer error. Done everything I could to try and figure it out. Can anybody help me find out what's wrong with it?

    Server log: http://pastebin.com/2futduPb
    Plugin event listener class: http://pastebin.com/LM17uaCT

    It just fires the text, but doesn't do any of the warping, any answer at all would be greatly appreciated.
     
  2. Offline

    amhokies

    joeygallegos
    Instead of declaring and initializing your World variable, sur, inside your class body, try making it a local variable inside of the method. You only really are using it in this method, so I don't see any reason why you would need to have it as an instance variable. Anyway, that seems to be where the error is coming from.
     
  3. Offline

    joeygallegos


    amhokies Thanks! Working perfectly now! Can you explain a little better as to why it works this way compared to my previous method?
     
  4. Offline

    amhokies

    How and where are you instanciating the Event class? That could give more insight as to what exactly the problem was.
     
  5. Offline

    Wizehh

    joeygallegos
    HTML:
    at me.joeygallegos.tbhe.Events.onSignInteract(Events.java:297) ~[?:?]
    Line 297:
    PHP:
    p.teleport(sur.getSpawnLocation());
    Is this world null?
    PHP:
    World sur Bukkit.getWorld("survival");
     
Thread Status:
Not open for further replies.

Share This Page