Strange error when listening to PlayerPortalEvent

Discussion in 'Plugin Development' started by Debels, Dec 11, 2013.

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

    Debels

    So I'm having a null pointer exception on PlayerPortalEvent, it sets getTo() null, Its from another world I load named worldSurvival (yes I'm making a private plugin to have multiple worlds), is this a problem for every new group of loaded worlds? (aka overworld, nether, end), if so do I have to make the calculations on where to spawn the player and create the portal?, if so how would I calculate where to spawn them on the end?
     
  2. Offline

    PolarCraft

    Can you please post the coding -_-
     
  3. Offline

    Debels

    PolarCraft there isn't an actual problem with the code as I indirectly pointed out above, but with the event when calling evt.getTo() its returning null.

    but if you still want to see the code behind it here it is: http://pastie.org/private/n7b6eefzrz8cgf8pvfr6dq#3 the line selected is where the error is, I debugged and evt.getTo() returns null.
     
  4. Offline

    PolarCraft

    What is WorldManager and worldName?
     
  5. Offline

    Debels

    PolarCraft Oh I forgot to post that part, worldName is just this:
    Code:
    String worldName = evt.getFrom().getWorld().getName();
    and WorldManager is the class where I manage everything world related. the method that it calls as the comment says is just to return the name of the nether name attached to that world if any.

    Bump...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  6. Offline

    JRL1004

    Debels You are expecting someone to find a null value in code you won't provide? Not to be mean but not many people here can close their eyes and see the part causing it in their head. If you want proper help on your nullpointer, you will have to show the class throwing the error, or at least the applicable code segment.
     
  7. Offline

    Debels

    JRL1004 the code is on the second post, but like I said, the error is not on my code, but rather on the evt.getTo() function, My guess would be that I have to set the destination and create the world, but I want to make sure first. but If I have to put the destination then, how would I know where to spawn them on the end?
     
Thread Status:
Not open for further replies.

Share This Page