mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Fixed server crash on invalid gamemode in SetPlayerGameTypePacket
this really ought to be detected at the decode layer, but right now that's a bit difficult ...
This commit is contained in:
@ -667,8 +667,8 @@ class InGamePacketHandler extends PacketHandler{
|
||||
}
|
||||
|
||||
public function handleSetPlayerGameType(SetPlayerGameTypePacket $packet) : bool{
|
||||
$converter = TypeConverter::getInstance();
|
||||
if(!$converter->protocolGameModeToCore($packet->gamemode)->equals($this->player->getGamemode())){
|
||||
$gameMode = TypeConverter::getInstance()->protocolGameModeToCore($packet->gamemode);
|
||||
if($gameMode === null || !$gameMode->equals($this->player->getGamemode())){
|
||||
//Set this back to default. TODO: handle this properly
|
||||
$this->session->syncGameMode($this->player->getGamemode(), true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user