mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 05:34:54 +00:00
Disallow weird characters in chat
This commit is contained in:
parent
e43b4e67c6
commit
1935e2bbf7
@ -875,7 +875,7 @@ class Player{
|
||||
$this->close("Incorrect protocol", false);
|
||||
break;
|
||||
}
|
||||
if(preg_match('#^[a-zA-Z0-9_]{2,16}$#', $data["username"])){
|
||||
if(preg_match('#[^a-zA-Z0-9_]#', $data["username"]) == 0){
|
||||
$this->username = $data["username"];
|
||||
$this->iusername = strtolower($this->username);
|
||||
}else{
|
||||
@ -1304,7 +1304,7 @@ class Player{
|
||||
break;
|
||||
}
|
||||
$message = $data["message"];
|
||||
if(trim($data["message"]) != ""){
|
||||
if(trim($data["message"]) != "" and preg_match('#[^\\x20-\\xff]#', $message) == 0){
|
||||
if($message{0} === "/"){ //Command
|
||||
$this->server->api->console->run(substr($message, 1), $this);
|
||||
}else{
|
||||
|
Loading…
x
Reference in New Issue
Block a user