示例#1
0
 public function execute(CommandSender $sender, $label, array $params)
 {
     if (!$this->plugin->isEnabled()) {
         return false;
     }
     if (!$this->testPermission($sender)) {
         return false;
     }
     $page = (int) array_shift($params);
     $server = $this->plugin->getServer();
     $banned = [];
     foreach ($server->getNameBans()->getEntries() as $entry) {
         if ($this->plugin->accountExists($entry->getName())) {
             $banned[] = $entry->getName();
         }
     }
     $ops = [];
     foreach ($server->getOps()->getAll() as $op) {
         if ($this->plugin->accountExists($op)) {
             $ops[] = $op;
         }
     }
     $task = new SortTask($sender, $this->plugin->getAllMoney(), $this->plugin->getConfig()->get("add-op-at-rank"), $page, $ops, $banned);
     $server->getScheduler()->scheduleAsyncTask($task);
 }