PlayerPreLoginEvent: before the Player has barely anything set up, just the username and some extremely primitive data PlayerLoginEvent: when things like player entity have been setup PlayerRespawnEvent: when spawnpoint is sent to the Player PlayerJoinEvent: when the Player has successfully joined and spawned.
I need it to kick the player before the join so i can' t use the respawn event (is called also when a player die) ... How i said i have already tried to use the PlayerPreloginEvent and the PlayerLoginEvent but the server kick the player and after some seconds crash PHP: Error: Call to a member function setHeldItemSlot() on nullFile: /src/pocketmine/Player__32bitLine: 1772Type: E_ERRORCode:[1763] if($ev->isCancelled()){[1764] $this->close($this->getLeaveMessage(), $ev->getKickMessage());[1765][1766] break;[1767] }[1768][1769] if($this->isCreative()){[1770] $this->inventory->setHeldItemSlot(0);[1771] }else{[1772] $this->inventory->setHeldItemSlot(0);[1773] }[1774][1775] $pk = new PlayStatusPacket();[1776] $pk->status = PlayStatusPacket::LOGIN_SUCCESS;[1777] $this->dataPacket($pk->setChannel(Network::CHANNEL_PRIORITY));[1778][1779] if($this->spawnPosition === \null and isset($this->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($this->namedtag["SpawnLevel"])) instanceof Level){[1780] $this->spawnPosition = new Position($this->namedtag["SpawnX"], $this->namedtag["SpawnY"], $this->namedtag["SpawnZ"], $level);[1781] }
crash report? and u can use the respawn event... u only have to set a array with playername by death and check it befor and if the players died do nothing... if (!isset($var[$name])
I need to modify the server is full message ... And i don' t know how ... So i tried to kick a player on join when the server is full and set a reason . Custom Alerts don' t work :/
is possibile to use $player->close("", "custom full server msg") on PlayerPreLoginEvent ? To change the message?
Hack: use DataPacketSendEvent. For setting message, $event->setKickMessage() Player::close() is not recommended. It is kind of PocketMine internals. Cancel PlayerKickEvent and kick the Player in PlayerLoginEvent with your message to $player->kick($reason)