mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 19:59:11 +00:00
Make GameMode::fromString() and PluginEnableOrder::fromString() return null, instead of throwing exceptions
since these are always used for handling userdata, it doesn't make sense for them to throw exceptions.
This commit is contained in:
@@ -53,9 +53,8 @@ class GamemodeCommand extends VanillaCommand{
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
|
||||
try{
|
||||
$gameMode = GameMode::fromString($args[0]);
|
||||
}catch(\InvalidArgumentException $e){
|
||||
$gameMode = GameMode::fromString($args[0]);
|
||||
if($gameMode === null){
|
||||
$sender->sendMessage("Unknown game mode");
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user