NullPointerException

Discussion in 'Plugin Development' started by mcatominey08, Apr 7, 2011.

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

    mcatominey08

    Hi,

    Ran into this problem with the stack trace leading to a player.sendMessage(String) call:

    00:35:51 [SEVERE] Could not pass event PLAYER_LOGIN to ReconnectLimiter
    java.lang.NullPointerException
    at org.bukkit.craftbukkit.entity.CraftPlayer.sendMessage(CraftPlayer.java:84)
    at mcatominey.reconnectlimiter.ReconnectLimiter.increasePlayer(ReconnectLimiter.java:88)
    at mcatominey.reconnectlimiter.ReconnectLimiter.checkPlayerLogin(ReconnectLimiter.java:107)
    at mcatominey.reconnectlimiter.ReconnectLimiterPlayerListener.onPlayerLogin(ReconnectLimiterPlayerListener.java:21)
    at org.bukkit.plugin.java.JavaPluginLoader$10.execute(JavaPluginLoader.java:223)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
    at net.minecraft.server.ServerConfigurationManager.a(ServerConfigurationManager.java:151)
    at net.minecraft.server.NetLoginHandler.b(NetLoginHandler.java:76)
    at net.minecraft.server.NetLoginHandler.a(NetLoginHandler.java:27)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:87)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)

    I think this has something to do with the name "craftplayer" being used, but I'm a bit lost, any help appreciated.
     
  2. Offline

    Kekec852

    You are trying to send null string ... String string == null!
     
  3. Offline

    mcatominey08

    It's definitely not that, the sendMessage function is used with a string inline eg.
    Code:
    player.sendMessage("This is a string!");
    It has to be with the player variable as this happens whenever I try to send a message to a player.
     
  4. Offline

    Kekec852

    I miss some part of stack trace. Part saying that you trying to send massage to palyer how is not in the system at that point ... as far as i know. Try different hook like PLAYER_JOIN. I try if you trying to send msg. from PLAYER_LOGIN it fails but not from PLAYER_JOIN ...

    http://dl.dropbox.com/u/13780763/BukkitTestPlugin.7z

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

    mcatominey08

    Solved with PLAYER_JOIN event, Thanks.
     
Thread Status:
Not open for further replies.

Share This Page