From 1a8cbdd6c7719ee05684acba2a98f69bcfc947aa Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 5 Apr 2014 14:02:35 +0200 Subject: [PATCH] Fixed players being able to add color codes in names and be shown on console (on kick) --- src/pocketmine/Player.php | 5 +++-- start.cmd | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index c787ae610..dced61e6e 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -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; diff --git a/start.cmd b/start.cmd index 0ded0adaf..68547354e 100644 --- a/start.cmd +++ b/start.cmd @@ -19,8 +19,12 @@ if exist PocketMine-MP.phar ( ) ) -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 %* +if exist bin\php\php_wxwidgets.dll ( + %PHP_BINARY% %POCKETMINE_FILE% --enable-gui %* ) else ( - %PHP_BINARY% %POCKETMINE_FILE% %* + 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% %* + ) )