Changed usage message displaying to exceptions to reduce boilerplate code

Someday this won't need to be done by commands themselves, it'll be done by the parser.
This commit is contained in:
Dylan K. Taylor
2017-07-04 13:44:47 +01:00
parent 409fc282d2
commit 97f6a32557
31 changed files with 128 additions and 108 deletions

View File

@ -25,6 +25,7 @@ namespace pocketmine\command\defaults;
use pocketmine\block\Block;
use pocketmine\command\CommandSender;
use pocketmine\command\utils\InvalidCommandSyntaxException;
use pocketmine\event\TranslationContainer;
use pocketmine\item\Item;
use pocketmine\level\particle\AngryVillagerParticle;
@ -77,9 +78,7 @@ class ParticleCommand extends VanillaCommand{
}
if(count($args) < 7){
$sender->sendMessage(new TranslationContainer("commands.generic.usage", [$this->usageMessage]));
return true;
throw new InvalidCommandSyntaxException();
}
if($sender instanceof Player){