本文整理汇总了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]);
}
}
}
}
示例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);
}
示例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.");
}
}
示例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]);
}
}
}
}
示例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);
}
}
示例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();
}
示例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());
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例12: onCompletion
public function onCompletion(Server $server)
{
$plugin = $server->getPluginManager()->getPlugin($this->pluginName);
if ($plugin === null) {
return;
}
$plugin->setExternalIp($this->ip);
}
示例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);
}
}
示例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);
}
}
示例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);
}