mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Fixed players being able to add color codes in names and be shown on console (on kick)
This commit is contained in:
@ -1262,7 +1262,8 @@ class Player extends Human implements CommandSender, IPlayer{
|
||||
if($this->loggedIn === true){
|
||||
break;
|
||||
}
|
||||
$this->username = $packet->username;
|
||||
|
||||
$this->username = TextFormat::clean($packet->username);
|
||||
$this->displayName = $this->username;
|
||||
$this->iusername = strtolower($this->username);
|
||||
$this->loginData = array("clientId" => $packet->clientId, "loginData" => $packet->loginData);
|
||||
@ -1286,7 +1287,7 @@ class Player extends Human implements CommandSender, IPlayer{
|
||||
|
||||
return;
|
||||
}
|
||||
if(preg_match('#^[a-zA-Z0-9_]{3,16}$#', $this->username) == 0 or $this->username === "" or $this->iusername === "rcon" or $this->iusername === "console"){
|
||||
if(preg_match('#^[a-zA-Z0-9_]{3,16}$#', $packet->username) == 0 or $this->username === "" or $this->iusername === "rcon" or $this->iusername === "console"){
|
||||
$this->close("", "Bad username");
|
||||
|
||||
return;
|
||||
|
Reference in New Issue
Block a user