Error after kicking player

Discussion in 'Plugin Development' started by Raider, Mar 12, 2011.

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

    Raider

    Ok, so i get this error when kicking a player

    Code:
    2011-03-13 00:36:31 [SEVERE] java.lang.IllegalStateException: Failed to remove player. net.minecraft.server.EntityPlayer@c0 isn't in chunk -10, -10
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.PlayerInstance.b(PlayerInstance.java:49)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.PlayerManager.b(PlayerManager.java:101)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.ServerConfigurationManager.c(ServerConfigurationManager.java:114)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:95)
    2011-03-13 00:36:31 [SEVERE]     at org.bukkit.craftbukkit.entity.CraftPlayer.kickPlayer(CraftPlayer.java:122)
    2011-03-13 00:36:31 [SEVERE]     at com.raider00321.AuthenticateIt.AuthenticateItPlayerListener.onPlayerJoin(AuthenticateItPlayerListener.java:70)
    2011-03-13 00:36:31 [SEVERE]     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:125)
    2011-03-13 00:36:31 [SEVERE]     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
    2011-03-13 00:36:31 [SEVERE]     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:226)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.ServerConfigurationManager.a(ServerConfigurationManager.java:98)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.NetLoginHandler.b(NetLoginHandler.java:87)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.NetLoginHandler.a(NetLoginHandler.java:68)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.Packet1Login.a(SourceFile:46)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.NetworkManager.a(SourceFile:230)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.NetLoginHandler.a(NetLoginHandler.java:34)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.NetworkListenThread.a(SourceFile:87)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:357)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:272)
    2011-03-13 00:36:31 [SEVERE]     at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    The kick works perfectly fine for the very first kick, but then seems to spam a few dozen errors of this into the console. The code i used is..

    Code:
    public void onPlayerJoin(PlayerEvent event)
        {
            if(event.getPlayer() != null)
            {
                InetAddress ip;
                Player player = event.getPlayer();
                InetSocketAddress playerIP = player.getAddress();
                String playerName = event.getPlayer().getName();
                ip = playerIP.getAddress();
                String toCheck = ip.toString();
                String toCheckAgainst = "/"+IPCheckSQL(playerName);
                try
                {
                    if(toCheck.equals(toCheckAgainst))
                    {
                        player.sendMessage("Correct Authentication ID");
                    }
                    else
                    {
                        if(player != null)
                        {
                            player.kickPlayer("Incorrect authorization Register or login that name at http://lpo.webhop.net");
                        }
                    }
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
        }
    
    Anyway, besides from this error, this app does exactly what its meant to, BUT i don't know exactly how to fix the problem.

    Anyone has any hints/tips/suggestions?
    [MERGETIME="1299948884"][/MERGETIME]
    oh! also, does anyone know if any way to get the user ip During the playerLogin event? I would much rather this in a onPlayerLogin event, but it doesn't seem to store the player IP until after this stage =/
     
  2. Offline

    eltorqiro

    I am not sure if I am on the right track, but the exception text is complaining that the player is not in a particular chunk (-10, -10), and thus cannot be kicked. Is it possible that at the time the PLAYER_JOIN event occurs, the player is not fully in the world yet, or that there is some race condition where he is in the world but the chunk he has spawned at has not been loaded yet?

    That is just a hunch based on the exception text, I have no idea if this suggestion is on the right track or not... As a workaround test, try using the bukkit scheduler to schedule a sync task to do the actual kicking of the player and set it for something like 20 ticks (1 second) to see if that helps.
     
  3. Offline

    Edward Hand

  4. Offline

    eltorqiro

    lol every time I think I have done something, you have done it before me! Curses! :) :)
     
  5. Offline

    Raider

    ironically, i figured out a fix for this yesterday... or more so. a work around i should say. The problem with putting it in on login was that the playerIP is not available. at that point in the script. or it seems so anyway. So i had to make a work around for it.. It wasnt the best solution, But at least I'm not really getting spammed errors with it now =P
    (would of preferred to do it exactly how you said if the needed data was there).
     
Thread Status:
Not open for further replies.

Share This Page