mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Merge pull request #1383 from pmmp/quoted-command-args
Quoted command args & allow playernames with spaces
This commit is contained in:
commit
30d2318bb7
@ -184,7 +184,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
public static function isValidUserName(string $name) : bool{
|
||||
$lname = strtolower($name);
|
||||
$len = strlen($name);
|
||||
return $lname !== "rcon" and $lname !== "console" and $len >= 1 and $len <= 16 and preg_match("/[^A-Za-z0-9_]/", $name) === 0;
|
||||
return $lname !== "rcon" and $lname !== "console" and $len >= 1 and $len <= 16 and preg_match("/[^A-Za-z0-9_ ]/", $name) === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -223,7 +223,7 @@ class SimpleCommandMap implements CommandMap{
|
||||
}
|
||||
|
||||
public function dispatch(CommandSender $sender, string $commandLine) : bool{
|
||||
$args = explode(" ", $commandLine);
|
||||
$args = array_map("stripslashes", str_getcsv($commandLine, " "));
|
||||
$sentCommandLabel = "";
|
||||
$target = $this->matchCommand($sentCommandLabel, $args);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user