From 2ff2a2de087f16a8b4381bc69d218e0f43676694 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 9 May 2018 16:58:55 +0100 Subject: [PATCH] FormattedCommandAlias: use multiple catch clauses --- src/pocketmine/command/FormattedCommandAlias.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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; }