Inheritance: extends VanillaCommand
コード例 #1
0
 public function execute(CommandSender $sender, $lbl, array $args)
 {
     parent::execute($sender, $lbl, $args);
     if ($this->testPermissionSilent($sender)) {
         $sender->sendMessage(sprintf("MySQL ping result: %s in %f milliseconds", $this->main->getMySQLi()->measurePing($micro) ? "success" : "failure", $micro * 1000));
     }
 }
コード例 #2
0
 public function execute(CommandSender $sender, $commandLabel, array $args)
 {
     $rcon = new RemoteConsoleCommandSender();
     $this->status->execute($rcon, "status", []);
     $messages = explode("\n", $rcon->getMessage());
     $output = TextFormat::GREEN . "=== GLOBAL STATUS ===\n";
     $this->getMain()->getPlayersCount($total, $max, $ctotal, $cmax);
     $this->getMain()->getServersCount($servers, $cservers);
     $red = TextFormat::RED;
     $output .= TextFormat::GOLD . "LegionPE Network:{$red} {$total} slots of {$max} used in {$servers} server(s)\n";
     $output .= TextFormat::GOLD . Settings::$CLASSES_NAMES[Settings::$LOCALIZE_CLASS] . ":{$red} {$total} slots of {$max} used in {$servers} server(s)\n";
     $output .= TextFormat::GREEN . "=== LOCAL STATUS (" . TextFormat::AQUA . Settings::$LOCALIZE_IP . ":" . Settings::$LOCALIZE_PORT . TextFormat::GREEN . ") ===\n";
     $sender->sendMessage($output);
     array_shift($messages);
     foreach ($messages as $message) {
         $sender->sendMessage($message);
     }
 }