Пример #1
0
 /**
  * @priority LOWEST
  */
 public function onRconCmd(RemoteServerCommandEvent $ev)
 {
     $res = $this->processCmd($ev->getCommand(), $ev->getSender());
     if ($res === false) {
         return;
     }
     $ev->setCommand($res);
 }
Пример #2
0
 /**
  * @param RemoteServerCommandEvent $event
  * @priority HIGHEST
  * @ignoreCancelled true
  */
 public function onRCONCmd(RemoteServerCommandEvent $event)
 {
     if ($event instanceof RemoteServerCommandEvent_sub) {
         return;
     }
     /** @var string|array $cmd */
     $cmd = $event->getCommand();
     if ($this->proceedCommand($event->getSender(), $cmd)) {
         if (count($cmd) > 0) {
             //$event->setCommand(array_shift($cmd));
             $event->setCancelled();
             foreach ($cmd as $c) {
                 $this->getServer()->getPluginManager()->callEvent($ev = new RemoteServerCommandEvent_sub($event->getSender(), $c));
                 if (!$ev->isCancelled()) {
                     $this->getServer()->dispatchCommand($ev->getSender(), $ev->getCommand());
                 }
             }
         }
     } else {
         $event->setCommand($cmd);
     }
 }