mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-24 11:54:23 +00:00
FormattedCommandAlias: use multiple catch clauses
This commit is contained in:
parent
78f8d54f89
commit
2ff2a2de08
@ -47,13 +47,12 @@ class FormattedCommandAlias extends Command{
|
||||
foreach($this->formatStrings as $formatString){
|
||||
try{
|
||||
$commands[] = $this->buildCommand($formatString, $args);
|
||||
}catch(\InvalidArgumentException $e){
|
||||
$sender->sendMessage(TextFormat::RED . $e->getMessage());
|
||||
return false;
|
||||
}catch(\Throwable $e){
|
||||
if($e instanceof \InvalidArgumentException){
|
||||
$sender->sendMessage(TextFormat::RED . $e->getMessage());
|
||||
}else{
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.exception"));
|
||||
$sender->getServer()->getLogger()->logException($e);
|
||||
}
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.exception"));
|
||||
$sender->getServer()->getLogger()->logException($e);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user