public dispatch ( pocketmine\command\CommandSender $sender, $commandLine ) | ||
$sender | pocketmine\command\CommandSender |
/** * Executes a command from a CommandSender * * @param CommandSender $sender * @param string $commandLine * * @return bool * * @throws \Exception */ public function dispatchCommand(CommandSender $sender, $commandLine) { if (!$sender instanceof CommandSender) { throw new ServerException("CommandSender is not valid"); } if ($this->commandMap->dispatch($sender, $commandLine)) { return true; } if ($sender instanceof Player) { $sender->sendMessage("Unknown command. Type \"/help\" for help."); } else { $sender->sendMessage("Unknown command. Type \"help\" for help."); } return false; }
/** * Executes a command from a CommandSender * * @param CommandSender $sender * @param string $commandLine * * @return bool * * @throws \Exception */ public function dispatchCommand(CommandSender $sender, $commandLine) { if (!$sender instanceof CommandSender) { throw new ServerException("CommandSender is not valid"); } if ($this->commandMap->dispatch($sender, $commandLine)) { return true; } $sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.notFound")); return false; }
/** * Executes a command from a CommandSender * * @param CommandSender $sender * @param string $commandLine * * @return bool * * @throws \Exception */ public function dispatchCommand(CommandSender $sender, $commandLine) { if (!$sender instanceof CommandSender) { throw new ServerException("CommandSender is not valid"); } if ($this->commandMap->dispatch($sender, $commandLine)) { return true; } if ($sender instanceof Player) { $message = $this->getAdvancedProperty("messages.unknown-command", "Unknown command. Type \"/help\" for help."); if (is_string($message) and strlen($message) > 0) { $sender->sendMessage(TextFormat::RED . $message); } } else { $sender->sendMessage("Unknown command. Type \"help\" for help."); } return false; }
/** * Executes a command from a CommandSender * * @param CommandSender $sender * @param string $commandLine * * @return bool * * @throws \Exception */ public function dispatchCommand(CommandSender $sender, $commandLine) { if ($this->commandMap->dispatch($sender, $commandLine)) { return true; } $sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.notFound")); return false; }