From 5b02ca8a642963c50b8b6d925b54cee0372487d1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 3 Jul 2019 14:34:22 +0100 Subject: [PATCH] InGamePacketHandler: return unhandled for command requests without a leading / some clients send things without the /, f.e. websocket stuff, and we aren't ready to handle that properly yet. The result is that the command gets dumped directly into the chat instead of being unhandled. --- .../network/mcpe/handler/InGamePacketHandler.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/network/mcpe/handler/InGamePacketHandler.php b/src/pocketmine/network/mcpe/handler/InGamePacketHandler.php index 48129dd3e..3ef0dc519 100644 --- a/src/pocketmine/network/mcpe/handler/InGamePacketHandler.php +++ b/src/pocketmine/network/mcpe/handler/InGamePacketHandler.php @@ -92,6 +92,7 @@ use function json_last_error_msg; use function microtime; use function preg_match; use function preg_split; +use function strpos; use function trim; /** @@ -589,7 +590,11 @@ class InGamePacketHandler extends PacketHandler{ } public function handleCommandRequest(CommandRequestPacket $packet) : bool{ - return $this->player->chat($packet->command); + if(strpos($packet->command, '/') === 0){ + $this->player->chat($packet->command); + return true; + } + return false; } public function handleCommandBlockUpdate(CommandBlockUpdatePacket $packet) : bool{