Hey, I'm having some issues with my plugin. I have this code to prevent players logging in from another location: PHP: public function onPreJoin(PlayerPreLoginEvent $plj){ if(array_key_exists($plj->getPlayer()->getName(),$this->pl)){ $this->getLogger()->info("§c" . $plj->getPlayer()->getName() . " was Kicked. Reason: Already Logged In!"); $plj->setCancelled(true); $plj->getPlayer()->kick("Already Logged In!"); } $this->pl is an array of players. And beFORE you mention "getOnlinePlayers()", that won't work because its a PRE join event, meaning the player will already be added to that array, making the plugin think that player is online - before he/she can join. Anyyyyway, i have a mini mysql system that saves the player's online/offline status. This works fine, but when someone is kicked due to the already logged in thing, an onQuit event is called - which will tell my system that the player is offline. Is there any way to stop the onQuit from being called? (I know setCancelled() but i don't want the actual event to be called.) Any ideas or suggestions?? Thanks
If you use getOnlinePlayers(), this problem will be fixed. PHP: foreach($this->getServer()->getOnlinePlayers() as $p){ if($p !== $plj->getPlayer() and strtolower($p->getName()) === strtolower($plj->getPlayer()->getName())){ $plj->getPlayer()->kick("Player already online"); break; }}