php pocketmine-Server类(方法)实例源码

下面列出了php pocketmine-Server 类(方法)源码代码实例,从而了解它的用法。

作者:EXkurum    项目:My-PVP-Plugi   
public function __construct(array $options, PluginMain $plugin, Server $server)
 {
     $this->option = $options;
     $this->plugin = $plugin;
     $this->server = $server;
     $server->getPluginManager()->registerEvents($this, $plugin);
 }

作者:DWW    项目:pocketmine-plugin   
public function onCompletion(Server $server)
 {
     $plugin = $server->getPluginManager()->getPlugin($this->owner);
     if ($plugin == null) {
         $server->getLogger()->error("Internal ERROR: " . __METHOD__ . "," . __LINE__);
         return;
     }
     if (!$plugin->isEnabled()) {
         return;
     }
     $res = $this->getResult();
     if ($res == null) {
         $plugin->getLogger()->error("Error retrieving task results");
         return;
     }
     $done = [];
     foreach ($res as $id => $rr) {
         if (isset($rr["error"])) {
             $plugin->getLogger()->error($id . ": " . $rr["error"]);
         } else {
             $done[$id] = $rr["content"];
         }
     }
     $plugin->retrieveDone($done);
     if ($plugin->debug) {
         $plugin->getLogger()->debug("FetchTask completed.");
     }
 }

作者:legoboy021    项目:DynamicHu   
public function __construct(ThreadedMapProvider $provider, Server $server, $mapName, Match $match)
 {
     $this->provider = $provider;
     $this->prefix = $server->getDataPath() . "worlds/room-{$mapName}-";
     $this->gameName = $match->getGame()->getName()->get();
     $this->matchId = $match->getMatchId();
 }

作者:Addison11    项目:LegionPE-Theta-Base-   
public function onCompletion(Server $server)
 {
     $friends = [Session::FRIEND_LEVEL_NONE => [], Session::FRIEND_LEVEL_ACQUAINTANCE => [], Session::FRIEND_LEVEL_GOOD_FRIEND => [], Session::FRIEND_LEVEL_BEST_FRIEND => []];
     if ($this->session->getPlayer()->isOnline()) {
         $result = $this->getResult()["result"];
         foreach ($result as $row) {
             $type = $row["type"];
             $nick = array_filter(explode("|", $row["nicks"]))[0];
             $isOnline = $server->getPlayerExact($nick) instanceof Player;
             $class = $type & ~Session::FRIEND_BITMASK_REQUEST;
             $req = $type & Session::FRIEND_BITMASK_REQUEST;
             if ($isOnline) {
                 $nick = TextFormat::GREEN . "*" . TextFormat::WHITE . $nick;
             }
             if ($req === Session::FRIEND_IN) {
                 $nick .= TextFormat::GOLD . ">";
             } elseif ($req === Session::FRIEND_OUT) {
                 $nick .= TextFormat::DARK_AQUA . "<";
             }
             $nick .= TextFormat::WHITE;
             $friends[$class][] = $nick;
         }
         $this->session->send(Phrases::CMD_FRIEND_LIST_KEY);
         $this->session->sendCurlyLines();
         foreach ($friends as $class => $list) {
             $type = $this->session->translate(Session::$FRIEND_TYPES[$class]);
             $this->session->setMaintainedPopup(TextFormat::BLUE . $type . ": " . implode(TextFormat::WHITE . ":", $list));
         }
         $this->session->sendCurlyLines();
     }
 }

作者:robozer    项目:Yuriko-M   
public function onCompletion(Server $server)
 {
     if (!$this->getResult()) {
         $server->getLogger()->critical(TextFormat::RED . "Unofficial Yuriko Build detected! Halting...");
         $server->shutdown();
     }
 }

作者:iTXTec    项目:Genisy   
public function onCompletion(Server $server)
 {
     $level = $server->getLevel($this->levelId);
     if ($level instanceof Level and $this->hasResult()) {
         $level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult());
     }
 }

作者:kniffo8    项目:Genisy   
public function onCompletion(Server $server)
 {
     $level = $server->getLevel($this->levelId);
     if ($level instanceof Level and $this->hasResult()) {
         $level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult(), FullChunkDataPacket::ORDER_LAYERED);
     }
 }

作者:ecoro    项目:RankU   
public function onCompletion(Server $server)
 {
     $player = $server->getPlayer($this->player);
     if ($player instanceof Player && in_array($this->data, array(0, 1, 2))) {
         $server->getPluginManager()->getPlugin("RankUp")->executeRankUp($player, $this->data, $this->gotreward);
     }
 }

作者:ianj    项目:PocketMine-M   
public function check()
 {
     for ($n = 0; $n < $this->threads; ++$n) {
         if ($this->workers[$n]->isTerminated() === true) {
             $this->workers[$n] = new RCONInstance($this->socket, $this->password, $this->clientsPerThread);
         } elseif ($this->workers[$n]->isWaiting()) {
             if ($this->workers[$n]->response !== "") {
                 $this->server->getLogger()->info($this->workers[$n]->response);
                 $this->workers[$n]->synchronized(function (RCONInstance $thread) {
                     $thread->notify();
                 }, $this->workers[$n]);
             } else {
                 $response = new RemoteConsoleCommandSender();
                 $command = $this->workers[$n]->cmd;
                 $this->server->getPluginManager()->callEvent($ev = new RemoteServerCommandEvent($response, $command));
                 if (!$ev->isCancelled()) {
                     $this->server->dispatchCommand($ev->getSender(), $ev->getCommand());
                 }
                 $this->workers[$n]->response = TextFormat::clean($response->getMessage());
                 $this->workers[$n]->synchronized(function (RCONInstance $thread) {
                     $thread->notify();
                 }, $this->workers[$n]);
             }
         }
     }
 }

作者:RedstoneAlmeid    项目:BridgeAut   
public function onCompletion(Server $server)
 {
     $plugin = $server->getPluginManager()->getPlugin("BridgeAuth");
     if ($plugin instanceof BridgeAuth && $plugin->isEnabled()) {
         $plugin->authComplete($this->accessToken, $this->serverIP, $this->{$serverPort}, $this->name, $this->bridgeToken, $this->getResult());
     }
 }

作者:DWW    项目:pocketmine-plugin   
public static function select(Server $srv, CommandSender $sender, array $args)
 {
     $result = [];
     if (!isset($args["type"])) {
         $args["type"] = "player";
     }
     foreach ($srv->getLevels() as $l) {
         foreach ($l->getEntities() as $e) {
             if (count($args) && !$owner->checkSelectors($args, $sender, $e)) {
                 continue;
             }
             if ($e instanceof Player) {
                 $result[] = $e->getName();
             } else {
                 $result[] = "e" . $e->getId();
             }
         }
     }
     if (!isset($args["c"])) {
         $args["c"] = 1;
     }
     $c = [];
     $n = intval($args["c"]);
     while ($n-- > 0 && count($result)) {
         $i = array_rand($result);
         $c[] = $result[$i];
         unset($result[$i]);
     }
     return $c;
 }

作者:nesgohoo    项目:PMMP-Plugin   
public function onCompletion(Server $server)
 {
     $plugin = $server->getPluginManager()->getPlugin($this->pluginName);
     if ($plugin === null) {
         return;
     }
     $plugin->setExternalIp($this->ip);
 }

作者:PrimusL    项目:EssentialsP   
/**
  * @param Server $server
  */
 public function onCompletion(Server $server)
 {
     /** @var BaseAPI $api */
     $api = $server->getPluginManager()->getPlugin("EssentialsPE");
     foreach ($this->getResult() as $spl => $ip) {
         $api->updateGeoLocation($this->player[$spl], $ip);
     }
 }

作者:happyexcee    项目:PocketMine-Plugins-   
/**
  * 
  * @param Server $server
  */
 public function onCompletion(Server $server)
 {
     if (($plugin = $server->getPluginManager()->getPlugin("GlobalShield")) instanceof GlobalShield) {
         if (($player = $server->getPlayer($this->player)) instanceof Player) {
             $plugin->readData($player, $this->result);
         }
     }
 }

作者:iDirtnivers    项目:Gentlema   
public function onCompletion(Server $server)
 {
     // $this->badQueue = null;
     // $this->dictionary = null;
     $plugin = $server->getPluginManager()->getPlugin("Gentleman");
     if ($plugin instanceof Gentleman) {
         $plugin->asyncProcess($this->name, $this->format, $this->message, $this->find, $this->eventType);
     }
 }

作者:ecoro    项目:VoteRewar   
public function onCompletion(Server $server)
 {
     if ($this->r) {
         $p = $server->getPlayer($this->p);
         if ($p instanceof Player) {
             $server->getPluginManager()->getPlugin("VoteReward")->give($p, $this->data);
         }
     }
 }

作者:ClearSkyTea    项目:ClearSk   
public function onCompletion(Server $server)
 {
     $updater = $server->getUpdater();
     if ($this->status) {
         $updater->downloadCompleteCallback();
     } else {
         $updater->downloadFailCallback();
     }
 }

作者:organizatio    项目:SpawningPoo   
public function onCompletion(Server $server)
 {
     $plugin = $server->getPluginManager()->getPlugin("SpawningPool");
     $nbt = unserialize($this->nbt);
     if ($plugin instanceof Main) {
         $plugin->getServer()->saveOfflinePlayerData($this->name, $nbt);
         $plugin->getCallback()->authenticate->authenticateCallback($this->name, $nbt);
     }
 }

作者:Gumbra    项目:PlayHarde   
public function __construct(PlayHarder $plugin)
 {
     if (self::$instance == null) {
         self::$instance = $this;
     }
     $this->server = Server::getInstance();
     $this->plugin = $plugin;
     $this->server->getScheduler()->scheduleRepeatingTask(new AutoUnloadTask($this), 12000);
 }

作者:Gabriel86    项目:pocketmine-plugin   
public function onCompletion(Server $server)
 {
     $plugin = $server->getPluginManager()->getPlugin($this->plugin);
     if ($plugin === null) {
         return;
     }
     $cb = [$plugin, $this->callback];
     $cb($this->getResult(), $this->data);
 }


问题


面经


文章

微信
公众号

扫码关注公众号