Bug - Cannot submit to offline player?

Discussion in 'Plugin Development' started by bloodless2010, Aug 11, 2013.

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

    bloodless2010

    Hi, I have a tiny little bug with a Plugin I made (I noticed while I was making another plugin xD)
    Basically, the plugin I was making kicks you if you don't have the right permission.
    But because of that, it causes some problems with my other plugin (Which uses the same event - login, to refresh a nametag) but, because it kicks the player first, the nametag refreshing causes some errors.
    Code:java
    1. @EventHandler
    2. public void login(PlayerLoginEvent event) {
    3. Player p = event.getPlayer();
    4. TagAPI.refreshPlayer(p);
    5. }

    Stacktrace:
    23:12:29 [SEVERE] Could not pass event PlayerLoginEvent to ezColour v1.0.0
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
    at net.minecraft.server.v1_6_R2.PlayerList.attemptLogin(PlayerList.java:334)
    at net.minecraft.server.v1_6_R2.PendingConnection.e(PendingConnection.java:120)
    at net.minecraft.server.v1_6_R2.PendingConnection.d(PendingConnection.java:43)
    at net.minecraft.server.v1_6_R2.DedicatedServerConnectionThread.a(DedicatedServerConnectionThread.java:41)
    at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:29)
    at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:590)
    at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:226)
    at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486)
    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419)
    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    Caused by: org.kitteh.tag.api.TagAPIException: Can't submit offline player!
    at org.kitteh.tag.TagAPI.refreshPlayer(TagAPI.java:117)
    at com.gmail.bloodless2010.ezcolour.ezColour.login(ezColour.java:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
    ... 13 more

    Is there a way of stopping this from happening ? I tried adding a check to see if the player was offline before running but it didn't work at all.
    Here's what I added;
    if (p == null){
    getLogger().info("Tried to change nametag of a user but failed as they are offline");
    } else {
    //rest of code here - they are online
    }

    Any ideas? Any help is appreciated!
     
  2. Offline

    Trevor1134

    What are the two plugins supposed to do? Without knowing, I can't help too much, but I can suggest you set the even priority to HIGHEST.
     
  3. Offline

    Janmm14

    Add to the method you pasted to @EventHandler this: (priority=MONITOR,ignoreCancelled=true)

    if that does not help, try to delay the refresh 1 tick.
     
Thread Status:
Not open for further replies.

Share This Page