diff --git a/src/pocketmine/command/FormattedCommandAlias.php b/src/pocketmine/command/FormattedCommandAlias.php index 926b409bc..771691626 100644 --- a/src/pocketmine/command/FormattedCommandAlias.php +++ b/src/pocketmine/command/FormattedCommandAlias.php @@ -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; }