From ab797975875d15391303e3ddf601ba5317e03f1b Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 5 Feb 2026 12:32:07 +0300 Subject: [PATCH] added illegal windows filenames(fixed #69) --- src/Player.php | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/Player.php b/src/Player.php index 4bcb8769..33eae0fc 100755 --- a/src/Player.php +++ b/src/Player.php @@ -4,7 +4,36 @@ class Player{ const CHATMESSAGE_ORDER_CHANNEL = 1; const BLOCKUPDATE_ORDER_CHANNEL = 2; const ENTITY_ORDER_CHANNEL = 3; - + public static $blacklistedUsernames = [ + "rcon" => true, + "console" => true, + "server" => true, + //windows my beloved + "con" => true, + "prn" => true, + "aux" => true, + "nul" => true, + "com1" => true, + "com2" => true, + "com3" => true, + "com4" => true, + "com5" => true, + "com6" => true, + "com7" => true, + "com8" => true, + "com9" => true, + "com0" => true, + "lpt1" => true, + "lpt2" => true, + "lpt3" => true, + "lpt4" => true, + "lpt5" => true, + "lpt6" => true, + "lpt7" => true, + "lpt8" => true, + "lpt9" => true, + "lpt0" => true + ]; public static $experimentalHotbar = false; public static $allowDroppingSingleItems = true; public static $disableEmojisInChat = true; @@ -2159,7 +2188,7 @@ class Player{ $this->close("Incorrect protocol #" . $packet->protocol1, false); return; } - if(preg_match('#[^a-zA-Z0-9_]#', $this->username) > 0 || $this->username === "" || $this->iusername === "rcon" || $this->iusername === "console" || $this->iusername === "server" || strlen($this->iusername) > 16){ + if(preg_match('#[^a-zA-Z0-9_]#', $this->username) > 0 || $this->username === "" || isset(Player::$blacklistedUsernames[$this->iusername]) || strlen($this->iusername) > 16){ $this->close("Bad username", false); return; }