Fixed players being able to add color codes in names and be shown on console (on kick)

This commit is contained in:
Shoghi Cervantes 2014-04-05 14:02:35 +02:00
parent 7be9ea68c7
commit 1a8cbdd6c7
2 changed files with 10 additions and 5 deletions

View File

@ -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;

View File

@ -19,8 +19,12 @@ if exist PocketMine-MP.phar (
)
)
if exist bin\php\php_wxwidgets.dll (
%PHP_BINARY% %POCKETMINE_FILE% --enable-gui %*
) else (
if exist bin\mintty.exe (
start "" bin\mintty.exe -o Columns=88 -o Rows=32 -o AllowBlinking=0 -o FontQuality=3 -o Font="DejaVu Sans Mono" -o FontHeight=10 -o CursorType=0 -o CursorBlinks=1 -h error -t "PocketMine-MP" -i bin/pocketmine.ico -w max %PHP_BINARY% %POCKETMINE_FILE% --enable-ansi %*
) else (
%PHP_BINARY% %POCKETMINE_FILE% %*
)
)