Player: move max players check to somewhere that makes sense

This commit is contained in:
Dylan K. Taylor 2018-07-20 13:22:08 +01:00
parent 3cd105ff33
commit 7633136a86

View File

@ -1846,10 +1846,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->locale = $packet->locale;
}
if(count($this->server->getOnlinePlayers()) >= $this->server->getMaxPlayers() and $this->kick("disconnectionScreen.serverFull", false)){
return true;
}
$this->randomClientId = $packet->clientId;
$this->uuid = UUID::fromString($packet->clientUUID);
@ -1878,6 +1874,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
return true;
}
if(count($this->server->getOnlinePlayers()) >= $this->server->getMaxPlayers() and $this->kick("disconnectionScreen.serverFull", false)){
return true;
}
if(!$this->server->isWhitelisted($this->iusername) and $this->kick("Server is white-listed", false)){
return true;
}