mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +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:
@ -91,7 +91,7 @@ class TypeConverter{
|
||||
}
|
||||
}
|
||||
|
||||
public function protocolGameModeToCore(int $gameMode) : GameMode{
|
||||
public function protocolGameModeToCore(int $gameMode) : ?GameMode{
|
||||
switch($gameMode){
|
||||
case ProtocolGameMode::SURVIVAL:
|
||||
return GameMode::SURVIVAL();
|
||||
@ -103,7 +103,7 @@ class TypeConverter{
|
||||
case ProtocolGameMode::SURVIVAL_VIEWER:
|
||||
return GameMode::SPECTATOR();
|
||||
default:
|
||||
throw new \UnexpectedValueException("Unmapped protocol game mode $gameMode");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user