PHP: <?phpnamespace NoSteve;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\event\player\PlayerPreLoginEvent;use pocketmine\Server;use pocketmine\Player;use pocketmine\utils\TextFormat as Color;class Main extends PluginBase implements Listener {public function onPreLogin(PlayerPreLoginEvent $event){ $player = $event->getPlayer(); if($player->getName() === "steve"){ $player->close(Color::RED ."In order to join this server" .Color::YELLOW ."\nYou must change your name" .Color::AQUA ."\n \n \nTo something other" .Color::GREEN ."\nThan Steve!"); $event->setCancelled(true); } }} This is not working, I need assistance! Thanks in advance
Use $event->setCancelled() and then $event->setKickMessage(). Cancelling the event already kicks the player. You don't need to close the player explicitly, and you should not. Also, next time, use kick() rather than close(); close() is only a PocketMine internal function. There is nothing wrong using PlayerPreLoginEvent. Also, you should check strtolower($player->getName()) instead, because == and === are case-insensitive.
This is a PocketMine bug; we are finding the most graceful way to fix this. And this happens to both PlayerLoginEvent and PlayerPreLoginEvent.