setCommand() public method

public setCommand ( string $command )
$command string
 public function onConsoleCmd(ServerCommandEvent $event)
 {
     if (isset($this->currentLine)) {
         $event->setCommand($this->currentLine . $event->getCommand());
         unset($this->currentLine);
     }
     $msg = $event->getCommand();
     if (preg_match('/^(.*)\\\\([a-z])$/', $msg, $match)) {
         $char = $match[2];
         switch ($char) {
             case self::CHAR_NORMAL:
                 $event->setCommand($match[1]);
                 break;
             case self::CHAR_RTRIM:
                 $event->setCommand(rtrim($match[1]));
                 break;
             case self::CHAR_CANCEL:
                 $event->setCancelled();
                 break;
             case self::CHAR_PUSH:
                 $event->setCancelled();
                 $this->simulateInput($match[1]);
                 break;
         }
     }
 }
 /**
  * @param ServerCommandEvent $event
  */
 public function onServerCommand(ServerCommandEvent $event)
 {
     $command = $this->getAPI()->colorMessage($event->getCommand());
     if ($command === false) {
         $event->setCancelled(true);
     }
     $event->setCommand($command);
 }
Example #3
0
 public function onServerCommandEvent(ServerCommandEvent $event)
 {
     $command = $event->getCommand();
     /*if($command(){0} == "/") $event->setCommand(str_replace("/", "", $event->getCommand()));*/
     if ($command[0] == "/") {
         $event->setCommand(substr($event->getCommand(), 1));
     }
 }
Example #4
0
 public function onServerCommand(ServerCommandEvent $event)
 {
     $event->setCommand($this->alias($event->getCommand()));
     $m = $this->specialCommand($event);
     if ($m !== false) {
         $event->setCommand($m);
     }
 }
Example #5
0
 /**
  * @priority LOWEST
  */
 public function onConsoleCmd(ServerCommandEvent $ev)
 {
     $res = $this->processCmd($ev->getCommand(), $ev->getSender());
     if ($res === false) {
         return;
     }
     $ev->setCommand($res);
 }
 /**
  * @param ServerCommandEvent $event
  * @priority HIGHEST
  * @ignoreCancelled true
  */
 public function onConsoleCmd(ServerCommandEvent $event)
 {
     if ($event instanceof ServerCommandEvent_sub) {
         return;
     }
     /** @var string|array $cmd */
     $cmd = $event->getCommand();
     if (DEBUGGING) {
         echo "Processing console command {$cmd}... ";
     }
     if ($this->proceedCommand($event->getSender(), $cmd)) {
         if (DEBUGGING) {
             echo "Parsed command recursively: ";
             var_dump($cmd);
             echo PHP_EOL;
         }
         $event->setCancelled();
         if (count($cmd) > 0) {
             foreach ($cmd as $c) {
                 $this->getServer()->getPluginManager()->callEvent($ev = new ServerCommandEvent_sub($event->getSender(), $c));
                 if (!$ev->isCancelled()) {
                     $this->getServer()->dispatchCommand($ev->getSender(), $ev->getCommand());
                 }
             }
         }
     } else {
         $event->setCommand($cmd);
         if (DEBUGGING) {
             echo "Command processed and changed to:\n{$cmd}\n";
         }
     }
 }
Example #7
0
 public function onServerCommand(ServerCommandEvent $event)
 {
     $event->setCommand($this->alias($event->getCommand()));
     if ($m = $this->eazyCommand($event)) {
         $event->setCommand($m);
     } else {
         $event->setCancelled();
     }
 }