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.
This commit is contained in:
Dylan K. Taylor 2019-07-03 14:34:22 +01:00
parent 720254f64f
commit 5b02ca8a64

View File

@ -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{