diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 73db652dc..218c6174f 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1661,10 +1661,9 @@ class Server{ Timings::$serverCommandTimer->startTiming(); if(($line = $this->console->getLine()) !== null){ $this->pluginManager->callEvent($ev = new ServerCommandEvent($this->consoleSender, $line)); - if($ev->isCancelled()){ - return; + if(!$ev->isCancelled()){ + $this->dispatchCommand($ev->getSender(), $ev->getCommand()); } - $this->dispatchCommand($this->consoleSender, $ev->getCommand()); } Timings::$serverCommandTimer->stopTiming(); } diff --git a/src/pocketmine/event/server/RemoteServerCommandEvent.php b/src/pocketmine/event/server/RemoteServerCommandEvent.php new file mode 100644 index 000000000..412c992c8 --- /dev/null +++ b/src/pocketmine/event/server/RemoteServerCommandEvent.php @@ -0,0 +1,40 @@ +notify(); }, $this->workers[$n]); }else{ - $this->server->dispatchCommand($response = new RemoteConsoleCommandSender(), $this->workers[$n]->cmd); + + $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();