From 466de8794835aefba486ef2ad99761c257e98b0a Mon Sep 17 00:00:00 2001 From: marshall Date: Tue, 26 Nov 2019 09:32:01 -0800 Subject: [PATCH 1/2] Escape player name with spaces for reliability I suggest adding another placeholder like `{esc_username}` for this (for aesthetic purposes) but I don't think anyone got time to change up their configurations just for that specific purpose. --- src/Buycraft/PocketMine/Execution/QueuedCommand.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Buycraft/PocketMine/Execution/QueuedCommand.php b/src/Buycraft/PocketMine/Execution/QueuedCommand.php index 2968146..9abb16a 100644 --- a/src/Buycraft/PocketMine/Execution/QueuedCommand.php +++ b/src/Buycraft/PocketMine/Execution/QueuedCommand.php @@ -78,6 +78,7 @@ public function canExecute() public function getFinalCommand() { + $escaped = strpos($un, ' ') !== false ? '"' . $this->username . '"' : $this->username; $command = str_replace( [ '{name}', @@ -88,9 +89,9 @@ public function getFinalCommand() '{id}' ], [ - $this->username, - $this->username, - $this->username, + $escaped, + $escaped, + $escaped, $this->xuid, $this->xuid, $this->xuid, @@ -100,4 +101,4 @@ public function getFinalCommand() return $command; } -} \ No newline at end of file +} From cc2b7a22b809abeb947feb4356f890ff39beff35 Mon Sep 17 00:00:00 2001 From: marshall Date: Tue, 26 Nov 2019 09:38:34 -0800 Subject: [PATCH 2/2] fix typo --- src/Buycraft/PocketMine/Execution/QueuedCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Buycraft/PocketMine/Execution/QueuedCommand.php b/src/Buycraft/PocketMine/Execution/QueuedCommand.php index 9abb16a..6371050 100644 --- a/src/Buycraft/PocketMine/Execution/QueuedCommand.php +++ b/src/Buycraft/PocketMine/Execution/QueuedCommand.php @@ -78,7 +78,7 @@ public function canExecute() public function getFinalCommand() { - $escaped = strpos($un, ' ') !== false ? '"' . $this->username . '"' : $this->username; + $escaped = strpos($this->username, ' ') !== false ? '"' . $this->username . '"' : $this->username; $command = str_replace( [ '{name}',