pocketmine\Server::dispatchCommand PHP 메소드

dispatchCommand() 공개 메소드

Executes a command from a CommandSender
public dispatchCommand ( pocketmine\command\CommandSender $sender, string $commandLine ) : boolean
$sender pocketmine\command\CommandSender
$commandLine string
리턴 boolean
    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;
    }

Usage Example

예제 #1
0
 public function check()
 {
     for ($n = 0; $n < $this->threads; ++$n) {
         if ($this->workers[$n]->isTerminated() === true) {
             $this->workers[$n] = new RCONInstance($this->socket, $this->password, $this->clientsPerThread);
         } elseif ($this->workers[$n]->isWaiting()) {
             if ($this->workers[$n]->response !== "") {
                 $this->server->getLogger()->info($this->workers[$n]->response);
                 $this->workers[$n]->synchronized(function (RCONInstance $thread) {
                     $thread->notify();
                 }, $this->workers[$n]);
             } else {
                 $response = new RemoteConsoleCommandSender();
                 $command = $this->workers[$n]->cmd;
                 $this->server->getPluginManager()->callEvent($ev = new RemoteServerCommandEvent($response, $command));
                 if (!$ev->isCancelled()) {
                     $this->server->dispatchCommand($ev->getSender(), $ev->getCommand());
                 }
                 $this->workers[$n]->response = TextFormat::clean($response->getMessage());
                 $this->workers[$n]->synchronized(function (RCONInstance $thread) {
                     $thread->notify();
                 }, $this->workers[$n]);
             }
         }
     }
 }
All Usage Examples Of pocketmine\Server::dispatchCommand
Server