当前位置: 首页>>代码示例>>PHP>>正文


PHP Server::getPluginManager方法代码示例

本文整理汇总了PHP中pocketmine\Server::getPluginManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::getPluginManager方法的具体用法?PHP Server::getPluginManager怎么用?PHP Server::getPluginManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\Server的用法示例。


在下文中一共展示了Server::getPluginManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check

 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]);
             }
         }
     }
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:26,代码来源:RCON.php

示例2: onCompletion

 public function onCompletion(Server $server)
 {
     if (isset($this->error)) {
         $server->getPluginManager()->getPlugin("VoteReward")->getLogger()->error($this->error);
     }
     $server->getPluginManager()->getPlugin("VoteReward")->rewardPlayer($server->getPlayerExact($this->id), $this->rewards);
     array_splice($server->getPluginManager()->getPlugin("VoteReward")->queue, array_search($this->id, $server->getPluginManager()->getPlugin("VoteReward")->queue, true), 1);
 }
开发者ID:MinecraftList,项目名称:VoteReward,代码行数:8,代码来源:RequestThread.php

示例3: onCompletion

 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.");
     }
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:28,代码来源:FetchTask.php

示例4: check

 public function check()
 {
     $d = Utils::getRealMemoryUsage();
     $u = Utils::getMemoryUsage(true);
     $usage = round($u[0] / 1024 / 1024, 2) . "/" . round($d[0] / 1024 / 1024, 2) . "/" . round($u[1] / 1024 / 1024, 2) . "/" . round($u[2] / 1024 / 1024, 2) . " MB @ " . Utils::getThreadCount() . " threads";
     $serverStatus = serialize(["online" => count($this->server->getOnlinePlayers()), "max" => $this->server->getMaxPlayers(), "upload" => round($this->server->getNetwork()->getUpload() / 1024, 2), "download" => round($this->server->getNetwork()->getDownload() / 1024, 2), "tps" => $this->server->getTicksPerSecondAverage(), "load" => $this->server->getTickUsageAverage(), "usage" => $usage]);
     for ($n = 0; $n < $this->threads; ++$n) {
         if (!$this->workers[$n]->isTerminated()) {
             $this->workers[$n]->serverStatus = $serverStatus;
         }
         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 = $response->getMessage();
                 $this->workers[$n]->synchronized(function (RCONInstance $thread) {
                     $thread->notify();
                 }, $this->workers[$n]);
             }
         }
     }
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:33,代码来源:RCON.php

示例5: onCompletion

 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);
     }
 }
开发者ID:ecoron,项目名称:RankUp,代码行数:7,代码来源:VoteRankTask.php

示例6: __construct

 public function __construct(Server $server, $timeout = 5)
 {
     $this->timeout = $timeout;
     $this->serverName = $server->getMotd();
     $this->listPlugins = $server->getProperty("settings.query-plugins", true);
     $this->plugins = $server->getPluginManager()->getPlugins();
     $this->players = [];
     foreach ($server->getOnlinePlayers() as $player) {
         if ($player->isOnline()) {
             $this->players[] = $player;
         }
     }
     if ($server->isDServerEnabled() and $server->dserverConfig["queryMaxPlayers"]) {
         $pc = $server->dserverConfig["queryMaxPlayers"];
     } elseif ($server->isDServerEnabled() and $server->dserverConfig["queryAllPlayers"]) {
         $pc = $server->getDServerMaxPlayers();
     } else {
         $pc = $server->getMaxPlayers();
     }
     if ($server->isDServerEnabled() and $server->dserverConfig["queryPlayers"]) {
         $poc = $server->getDServerOnlinePlayers();
     } else {
         $poc = count($this->players);
     }
     $this->gametype = ($server->getGamemode() & 0x1) === 0 ? "SMP" : "CMP";
     $this->version = $server->getVersion();
     $this->server_engine = $server->getName() . " " . $server->getPocketMineVersion();
     $this->map = $server->getDefaultLevel() === null ? "unknown" : $server->getDefaultLevel()->getName();
     $this->numPlayers = $poc;
     $this->maxPlayers = $pc;
     $this->whitelist = $server->hasWhitelist() ? "on" : "off";
     $this->port = $server->getPort();
     $this->ip = $server->getIp();
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:34,代码来源:QueryRegenerateEvent.php

示例7: onCompletion

 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());
     }
 }
开发者ID:RedstoneAlmeida,项目名称:BridgeAuth,代码行数:7,代码来源:AuthenticateTask.php

示例8: __construct

 public function __construct(array $options, PluginMain $plugin, Server $server)
 {
     $this->option = $options;
     $this->plugin = $plugin;
     $this->server = $server;
     $server->getPluginManager()->registerEvents($this, $plugin);
 }
开发者ID:EXkurumi,项目名称:My-PVP-Plugin,代码行数:7,代码来源:SimpleTeamBattle.php

示例9: onCompletion

 /**
  * 
  * @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);
         }
     }
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:12,代码来源:CheckAddressTask.php

示例10: onCompletion

 /**
  * @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);
     }
 }
开发者ID:PrimusLV,项目名称:EssentialsPE,代码行数:11,代码来源:GeoLocation.php

示例11: disablePlugin

 /**
  * @param Plugin $plugin
  */
 public function disablePlugin(Plugin $plugin)
 {
     if ($plugin instanceof PluginBase and $plugin->isEnabled()) {
         $this->server->getLogger()->info("Disabling " . $plugin->getDescription()->getFullName());
         $this->server->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
         $plugin->setEnabled(\false);
     }
 }
开发者ID:Edwardthedog2,项目名称:Steadfast2,代码行数:11,代码来源:PharPluginLoader.php

示例12: onCompletion

 public function onCompletion(Server $server)
 {
     $plugin = $server->getPluginManager()->getPlugin($this->pluginName);
     if ($plugin === null) {
         return;
     }
     $plugin->setExternalIp($this->ip);
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:8,代码来源:GetExternalIPAsyncTask.php

示例13: disablePlugin

 /**
  * @param Plugin $plugin
  */
 public function disablePlugin(Plugin $plugin)
 {
     if ($plugin instanceof PluginBase and $plugin->isEnabled()) {
         $this->server->getKatana()->console->plugin("Disabling " . Terminal::$COLOR_WHITE . $plugin->getDescription()->getFullName());
         $this->server->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
         $plugin->setEnabled(false);
     }
 }
开发者ID:Guillaume351,项目名称:Katana,代码行数:11,代码来源:PharPluginLoader.php

示例14: disablePlugin

 /**
  * @param Plugin $plugin
  */
 public function disablePlugin(Plugin $plugin)
 {
     if ($plugin instanceof PluginBase and $plugin->isEnabled()) {
         $this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.plugin.disable", [$plugin->getDescription()->getFullName()]));
         $this->server->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
         $plugin->setEnabled(false);
     }
 }
开发者ID:ianju,项目名称:PocketMine-MP,代码行数:11,代码来源:ScriptPluginLoader.php

示例15: onCompletion

 public function onCompletion(Server $server)
 {
     $plugin = $server->getPluginManager()->getPlugin($this->plugin);
     if ($plugin === null) {
         return;
     }
     $cb = [$plugin, $this->callback];
     $cb($this->getResult(), $this->data);
 }
开发者ID:Gabriel865,项目名称:pocketmine-plugins,代码行数:9,代码来源:RconTask.php


注:本文中的pocketmine\Server::getPluginManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。