i tried this, but it doesn't work if someone log in with my name, he gets kicked, but it unlog me :/ it seems like PlayerPreLoginEvent is called twice PHP: public function onPreLogin(PlayerPreLoginEvent $e){ $player = $e->getPlayer(); foreach($this->getServer()->getOnlinePlayers() as $p){ if($p !== $player && strtolower($player->getName()) === strtolower($p->getName())){ $e->setCancelled(); $e->setKickMessage(TextFormat::RED."The same nick is already playing"); return; } } $this->unauthed[strtolower($player->getName())] = $player; } i tried change pocketmine method too (method runs before PlayerLoginEvent) but PlayerLoginEvent is still called -,- PHP: foreach($this->server->getOnlinePlayers() as $p){ if($p !== $this && strtolower($p->getName()) == strtolower($this->getName())){ if($this->kick(TextFormat::RED."The same nick is already playing")){ $this->close($this->getLeaveMessage(), TextFormat::RED."The same nick is already playing"); return; } } }
Unlog? But isn't it something that only your plugin does? Add echo lines at critical points to log the control flow.