本文整理汇总了PHP中pocketmine\Server类的典型用法代码示例。如果您正苦于以下问题:PHP Server类的具体用法?PHP Server怎么用?PHP Server使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Server类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(array $options, PluginMain $plugin, Server $server)
{
$this->option = $options;
$this->plugin = $plugin;
$this->server = $server;
$server->getPluginManager()->registerEvents($this, $plugin);
}
示例2: 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.");
}
}
示例3: __construct
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();
}
示例4: onCompletion
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();
}
}
示例5: onCompletion
public function onCompletion(Server $server)
{
if (!$this->getResult()) {
$server->getLogger()->critical(TextFormat::RED . "Unofficial Yuriko Build detected! Halting...");
$server->shutdown();
}
}
示例6: onCompletion
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());
}
}
示例7: onCompletion
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);
}
}
示例8: 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);
}
}
示例9: 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]);
}
}
}
}
示例10: 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());
}
}
示例11: select
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;
}
示例12: onCompletion
public function onCompletion(Server $server)
{
$plugin = $server->getPluginManager()->getPlugin($this->pluginName);
if ($plugin === null) {
return;
}
$plugin->setExternalIp($this->ip);
}
示例13: 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);
}
}
示例14: 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);
}
}
}
示例15: onCompletion
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);
}
}