Error

Discussion in 'Spigot Plugin Development' started by Jirik, Jul 10, 2015.

  1. Code (Text):
    [18:46:33 ERROR]: Could not pass event PlayerJoinEvent to HayAnni v1.0
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:302) ~[server.jar:git-Spigot-1649]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[server.jar:git-Spigot-1649]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:514) [server.jar:git-Spigot-1649]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:499) [server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.PlayerList.c(PlayerList.java:265) [serve
    r.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.PlayerList.a(PlayerList.java:152) [serve
    r.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.LoginListener.c(LoginListener.java:119)
    [server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.LoginListener.a(LoginListener.java:44) [
    server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:189
    ) [server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java
    :81) [server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:7
    34) [server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:2
    89) [server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:5
    84) [server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java
    :490) [server.jar:git-Spigot-1649]
            at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:6
    28) [server.jar:git-Spigot-1649]
    Caused by: java.lang.NullPointerException
            at org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer.teleport(CraftPlaye
    r.java:500) ~[server.jar:git-Spigot-1649]
            at org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity.teleport(CraftEntit
    y.java:200) ~[server.jar:git-Spigot-1649]
            at cz.HayCraft.HayAnni.Main.onPlayerJoin(Main.java:38) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
    _45]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
    _45]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_45]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:298) ~[server.jar:git-Spigot-1649]
            ... 14 more
     
  2. Guys, code...
    Main.java, line 38.
     
  3. Probably variable 'lobby' is null because world 'Lobby' doesn't exist.
     
  4. but lobby isn't null
     
  5. Give me only line 38.
     
  6. Code (Text):
            e.getPlayer().teleport(lobby);
     
  7. Add before teleport:
    Code (Text):

    if (lobby == null) {
        e.getPlayer().sendMessage("Lobby is null!");
        return;
    }
     
     
    • Agree Agree x 1
  8. Try to initialize 'lobby' in onEnable.
     
  9. no, again error
     
  10. Is the plugin loaded before that world is loaded?
     
  11. no plugin load after load world
     
  12. what? now its OK
     
    • Winner Winner x 1