Code: @Override public void onPlayerJoin(PlayerEvent event){ if (plugin.isBanned(event.getPlayer())==true){ event.getPlayer().kickPlayer("You are banned from this server!"); } } in first time when player trying to connect - everything is normal, but if he try it more times, i see this in console(+100500 times): what im doing wrong? PS sry for my english
I really wanted to know that too It can slow down the server a bit if the player tries to come back thousand times.
Ah. I've investigated this error before. It happens because the onPlayerJoin event is called before the player is actually added into the game world. When you kick the player it tries to remove them from the game world and if they're not there it gets upset. What you need to do is use the onPlayerLogin event and set: Code: theLoginEvent.setResult(Result.KICK_BANNED); and it should work fine.
Damn. That's bad. Because when PlayerLoginEvent is called, there is no enough data(IP address) for me to kick the guy. Is there any other thing I can do? --- Maybe I schedule the kick to around 100 ticks after the Join. That could fix it. It's an horrible workaround. But if anyone have other idea.