예제 #1
0
 public function ServerCommand(ServerCommandEvent $event)
 {
     $command = $event->getCommand();
     if ($event->isCancelled()) {
         return false;
     }
     if ($command == 'stop') {
         $event->setCancelled();
         $this->getServer()->broadcastMessage(TextFormat::DARK_PURPLE . "[안내] 서버가 5초 뒤 재부팅됩니다 *stop 명령어 작동");
         $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "entitiesSave"]), 20 * 5);
     }
 }
예제 #2
0
 /**
  * @priority HIGHEST
  */
 public function onServerCommandProcess(ServerCommandEvent $event)
 {
     if (!$event->isCancelled() && stripos("save-all", $command = $event->getCommand()) === 0) {
         $this->checkSaveAll($event->getSender());
     }
 }
예제 #3
0
 public function checkConsole()
 {
     Timings::$serverCommandTimer->startTiming();
     if (($line = $this->console->getLine()) !== null) {
         $this->pluginManager->callEvent($ev = new ServerCommandEvent($this->consoleSender, $line));
         if (!$ev->isCancelled()) {
             $this->dispatchCommand($ev->getSender(), $ev->getCommand());
         }
     }
     Timings::$serverCommandTimer->stopTiming();
 }