Esempio n. 1
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);
     }
 }
Esempio n. 2
0
 /**
  * @priority HIGHEST
  */
 public function onRconCmd(RemoteServerCommandEvent $ev)
 {
     if ($ev instanceof RemoteServerCommandEvent_sub) {
         return;
     }
     $res = $this->processCmd($ev->getCommand(), $ev->getSender());
     if ($res === false) {
         return;
     }
     $ev->setCancelled();
     foreach ($res as $c) {
         $this->owner->getServer()->getPluginManager()->callEvent($ne = new RemoteServerCommandEvent_sub($ev->getSender(), $c));
         if ($ne->isCancelled()) {
             continue;
         }
         $this->owner->getServer()->dispatchCommand($ne->getSender(), $ne->getCommand());
     }
 }