NullPointerException on teleport (map loaded)

Discussion in 'Plugin Development' started by Altarry, Oct 21, 2014.

Thread Status:
Not open for further replies.
  1. Hello guys,

    I want create a game. I use the plugin multiverse for create worlds for arenas.
    So, my plugin copy a default world (no game in that world) and paste it. (regeneration system).
    I teleport the player if that click on a sign.

    My code of teleport is here:
    Code:java
    1. p.teleport(new Location(Bukkit.getWorld("lobby"+id), -1028.5, 5, 318.5));

    and this code give me a error, "nullpointerexception".
    but, it's strange beceause my world is import by send command to multiverse
    Code:java
    1. Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "mv import lobby"+id+" normal");


    Please help me, i think is just a no loaded complety map, i'm very lost....

    error:
    Code:java
    1. [22:55:56] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to RoboticRush v1.0
    2. org.bukkit.event.EventException
    3. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:294) ~[craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    4. at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    5. at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    6. at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    7. at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:216) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    8. at net.minecraft.server.v1_7_R3.PlayerInteractManager.interact(PlayerInteractManager.java:374) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    9. at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java:629) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    10. at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.a(SourceFile:60) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    11. at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.handle(SourceFile:9) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    12. at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:157) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    13. at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    14. at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:667) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    15. at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:260) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    16. at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    17. at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    18. at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    19. Caused by: java.lang.NullPointerException
    20. at org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer.teleport(CraftPlayer.java:484) ~[craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    21. at org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity.teleport(CraftEntity.java:200) ~[craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    22. at org.roboticrush.xmalware.events.ClickSign.joinGame(ClickSign.java:168) ~[?:?]
    23. at org.roboticrush.xmalware.events.ClickSign.onClick(ClickSign.java:110) ~[?:?]
    24. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
    25. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_67]
    26. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_67]
    27. at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_67]
    28. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:292) ~[craftbukkit-instable.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    29. ... 15 more


    good evening everyone.


    (Let me rephrase: I want to create a game there's a world he part that downloads from a world basis (default_game), for example Part 2 default_game copy the map, the names and load lobby2 with multiverse. . I want to teleport the person to play with the line in my first post I made and it gives me an error that I also scored in my first post.)
     
  2. Offline

    Epicballzy

    It would help a ton if you could type proper sentences. Having a hard time understanding what you mean.
     
  3. Let me rephrase: I want to create a game there's a world he part that downloads from a world basis (default_game), for example Part 2 default_game copy the map, the names and load lobby2 with multiverse. . I want to teleport the person to play with the line in my first post I made and it gives me an error that I also scored in my first post.
     
  4. Offline

    Walruski

    What is: at org.roboticrush.xmalware.events.ClickSign.joinGame(ClickSign.java:168)?
    Paste me the line please.
     

  5. Voila the line : p.teleport(new Location(Bukkit.getWorld("lobby"+id), -1028.5, 5, 318.5));
     
  6. Offline

    Walruski

    Well, my guess is that the world is null, add some checks before that line to see if it is the world which is null:

    if (Bukkit.getWorld("lobby" + id) == null) { Bukkit.broadcastMessage("World is null"); }

    It should help you with reaching your problem.
     

  7. My world is loaded by multiverse and figure on the multiverse world list :/
     
  8. Offline

    Walruski

    The only thing there that can throw a NPE is the player variable and the world. If you're clicking a sign (PlayerInteractEvent) then I'm certain that it is not the player (unless you're trying to use another player). Therefore, the only other thing that can be null is the world. Either the world you are trying to import does not already exist on your server or you're trying to teleport a player who is not online.
     
  9. The player is online....
     
  10. Offline

    Walruski

    Ok then, the world is null. You'll need to find out why it is null (I've suggested a few things above). Try looking at the multiverse commands and see if you're doing it right (importing a world which is already in your server directory).
     
Thread Status:
Not open for further replies.

Share This Page