mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-25 20:33:59 +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){
|
foreach($this->formatStrings as $formatString){
|
||||||
try{
|
try{
|
||||||
$commands[] = $this->buildCommand($formatString, $args);
|
$commands[] = $this->buildCommand($formatString, $args);
|
||||||
|
}catch(\InvalidArgumentException $e){
|
||||||
|
$sender->sendMessage(TextFormat::RED . $e->getMessage());
|
||||||
|
return false;
|
||||||
}catch(\Throwable $e){
|
}catch(\Throwable $e){
|
||||||
if($e instanceof \InvalidArgumentException){
|
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.exception"));
|
||||||
$sender->sendMessage(TextFormat::RED . $e->getMessage());
|
$sender->getServer()->getLogger()->logException($e);
|
||||||
}else{
|
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.exception"));
|
|
||||||
$sender->getServer()->getLogger()->logException($e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user