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


PHP Server::getTick方法代码示例

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


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

示例1: __construct

 public function __construct(Server $server, $type, $playerList = [])
 {
     $endpoint = "http://" . $server->getProperty("anonymous-statistics.host", "stats.pocketmine.net") . "/";
     $data = [];
     $data["uniqueServerId"] = $server->getServerUniqueId()->toString();
     $data["uniqueMachineId"] = Utils::getMachineUniqueId()->toString();
     $data["uniqueRequestId"] = UUID::fromData($server->getServerUniqueId(), microtime(true))->toString();
     switch ($type) {
         case self::TYPE_OPEN:
             $data["event"] = "open";
             $version = new VersionString();
             $data["server"] = ["port" => $server->getPort(), "software" => $server->getName(), "fullVersion" => $version->get(true), "version" => $version->get(), "build" => $version->getBuild(), "api" => $server->getApiVersion(), "minecraftVersion" => $server->getVersion(), "protocol" => Info::CURRENT_PROTOCOL];
             $data["system"] = ["operatingSystem" => Utils::getOS(), "cores" => Utils::getCoreCount(), "phpVersion" => PHP_VERSION, "machine" => php_uname("a"), "release" => php_uname("r"), "platform" => php_uname("i")];
             $data["players"] = ["count" => 0, "limit" => $server->getMaxPlayers()];
             $plugins = [];
             foreach ($server->getPluginManager()->getPlugins() as $p) {
                 $d = $p->getDescription();
                 $plugins[$d->getName()] = ["name" => $d->getName(), "version" => $d->getVersion(), "enabled" => $p->isEnabled()];
             }
             $data["plugins"] = $plugins;
             break;
         case self::TYPE_STATUS:
             $data["event"] = "status";
             $data["server"] = ["ticksPerSecond" => $server->getTicksPerSecondAverage(), "tickUsage" => $server->getTickUsageAverage(), "ticks" => $server->getTick()];
             //This anonymizes the user ids so they cannot be reversed to the original
             foreach ($playerList as $k => $v) {
                 $playerList[$k] = md5($v);
             }
             $players = [];
             foreach ($server->getOnlinePlayers() as $p) {
                 if ($p->isOnline()) {
                     $players[] = md5($p->getUniqueId()->toBinary());
                 }
             }
             $data["players"] = ["count" => count($players), "limit" => $server->getMaxPlayers(), "currentList" => $players, "historyList" => array_values($playerList)];
             $info = Utils::getMemoryUsage(true);
             $data["system"] = ["mainMemory" => $info[0], "totalMemory" => $info[1], "availableMemory" => $info[2], "threadCount" => Utils::getThreadCount()];
             break;
         case self::TYPE_CLOSE:
             $data["event"] = "close";
             $data["crashing"] = $server->isRunning();
             break;
     }
     $this->endpoint = $endpoint . "api/post";
     $this->data = json_encode($data);
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:46,代码来源:SendUsageTask.php

示例2: __construct

 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     if ($chunk === null or $chunk->getProvider() === null) {
         throw new ChunkException("Invalid garbage Chunk given to Entity");
     }
     $this->timings = Timings::getEntityTimings($this);
     if ($this->eyeHeight === null) {
         $this->eyeHeight = $this->height / 2 + 0.1;
     }
     $this->id = Entity::$entityCount++;
     $this->justCreated = true;
     $this->namedtag = $nbt;
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->setPositionAndRotation(new Vector3($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1], true);
     $this->setMotion(new Vector3($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
     if (!isset($this->namedtag->FallDistance)) {
         $this->namedtag->FallDistance = new Float("FallDistance", 0);
     }
     $this->fallDistance = $this->namedtag["FallDistance"];
     if (!isset($this->namedtag->Fire)) {
         $this->namedtag->Fire = new Short("Fire", 0);
     }
     $this->fireTicks = $this->namedtag["Fire"];
     if (!isset($this->namedtag->Air)) {
         $this->namedtag->Air = new Short("Air", 300);
     }
     $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $this->namedtag["Air"]);
     if (!isset($this->namedtag->OnGround)) {
         $this->namedtag->OnGround = new Byte("OnGround", 0);
     }
     $this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($this->namedtag->Invulnerable)) {
         $this->namedtag->Invulnerable = new Byte("Invulnerable", 0);
     }
     $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
     $this->chunk->addEntity($this);
     $this->level->addEntity($this);
     $this->initEntity();
     $this->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
     $this->checkBlockCollisionTicks = (int) $this->server->getAdvancedProperty("main.check-block-collision", 1);
     $this->scheduleUpdate();
 }
开发者ID:RedstoneAlmeida,项目名称:Steadfast2,代码行数:46,代码来源:Entity.php

示例3: scheduleUpdate

 /**
  * @param Vector3 $pos
  * @param int     $delay
  */
 public function scheduleUpdate(Vector3 $pos, $delay)
 {
     if (isset($this->updateQueueIndex[$index = PHP_INT_SIZE === 8 ? ($pos->x & 0xfffffff) << 35 | ($pos->y & 0x7f) << 28 | $pos->z & 0xfffffff : $pos->x . ":" . $pos->y . ":" . $pos->z]) and $this->updateQueueIndex[$index] <= $delay) {
         return;
     }
     $this->updateQueueIndex[$index] = $delay;
     $this->updateQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), (int) $delay + $this->server->getTick());
 }
开发者ID:RedstoneAlmeida,项目名称:Steadfast2,代码行数:12,代码来源:Level.php

示例4: scheduleUpdate

 /**
  * @param Vector3 $pos
  * @param int     $delay
  */
 public function scheduleUpdate(Vector3 $pos, $delay)
 {
     if (isset($this->updateQueueIndex[$index = Level::blockHash($pos->x, $pos->y, $pos->z)]) and $this->updateQueueIndex[$index] <= $delay) {
         return;
     }
     $this->updateQueueIndex[$index] = $delay;
     $this->updateQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), (int) $delay + $this->server->getTick());
 }
开发者ID:robozeri,项目名称:Yuriko-MP,代码行数:12,代码来源:Level.php

示例5: setRedstoneUpdate

 /**
  * @param Vector3 $pos
  * @param int     $delay
  */
 public function setRedstoneUpdate(Vector3 $pos, $delay, $type, $power)
 {
     if ($this->server->getProperty("redstone.enable", true)) {
         if (isset($this->updateRedstoneQueueIndex[$index = Level::blockHash($pos->x, $pos->y, $pos->z)]) and $this->updateRedstoneQueueIndex[$index]['delay'] <= $delay) {
             return;
         }
         $this->updateRedstoneQueueIndex[$index]['delay'] = $delay;
         $this->updateRedstoneQueueIndex[$index]['type'] = $type;
         $this->updateRedstoneQueueIndex[$index]['power'] = $power;
         $this->updateRedstoneQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), (int) $delay + $this->server->getTick());
     }
     return;
 }
开发者ID:orlando092,项目名称:ImagicalMine,代码行数:17,代码来源:Level.php

示例6: __construct

 public function __construct(FullChunk $chunk, CompoundTag $nbt)
 {
     assert($chunk !== null and $chunk->getProvider() !== null);
     $this->timings = Timings::getEntityTimings($this);
     $this->isPlayer = $this instanceof Player;
     $this->temporalVector = new Vector3();
     if ($this->eyeHeight === null) {
         $this->eyeHeight = $this->height / 2 + 0.1;
     }
     $this->id = Entity::$entityCount++;
     $this->justCreated = true;
     $this->namedtag = $nbt;
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->setPositionAndRotation($this->temporalVector->setComponents($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1]);
     $this->setMotion($this->temporalVector->setComponents($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
     assert(!is_nan($this->x) and !is_infinite($this->x) and !is_nan($this->y) and !is_infinite($this->y) and !is_nan($this->z) and !is_infinite($this->z));
     if (!isset($this->namedtag->FallDistance)) {
         $this->namedtag->FallDistance = new FloatTag("FallDistance", 0);
     }
     $this->fallDistance = $this->namedtag["FallDistance"];
     if (!isset($this->namedtag->Fire) || $this->namedtag["Fire"] > 32767) {
         $this->namedtag->Fire = new ShortTag("Fire", 0);
     }
     $this->fireTicks = $this->namedtag["Fire"];
     if (!isset($this->namedtag->Air)) {
         $this->namedtag->Air = new ShortTag("Air", 300);
     }
     $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $this->namedtag["Air"], false);
     if (!isset($this->namedtag->OnGround)) {
         $this->namedtag->OnGround = new ByteTag("OnGround", 0);
     }
     $this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($this->namedtag->Invulnerable)) {
         $this->namedtag->Invulnerable = new ByteTag("Invulnerable", 0);
     }
     $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
     $this->attributeMap = new AttributeMap();
     $this->chunk->addEntity($this);
     $this->level->addEntity($this);
     $this->initEntity();
     $this->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
     $this->scheduleUpdate();
 }
开发者ID:robske110,项目名称:ClearSky,代码行数:47,代码来源:Entity.php

示例7: setRedstoneUpdate

 /**
  * @param Vector3 $pos
  * @param int     $delay
  */
 public function setRedstoneUpdate(Vector3 $pos, $delay, $type, $power)
 {
     if (!$this->getServer()->isAllowRedstoneCalculation()) {
         return;
     }
     if (isset($this->updateRedstoneQueueIndex[$index = Level::blockHash($pos->x, $pos->y, $pos->z)]) and $this->updateRedstoneQueueIndex[$index]['delay'] <= $delay) {
         return;
     }
     $this->updateRedstoneQueueIndex[$index]['delay'] = $delay;
     $this->updateRedstoneQueueIndex[$index]['type'] = $type;
     $this->updateRedstoneQueueIndex[$index]['power'] = $power;
     $this->updateRedstoneQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), (int) $delay + $this->server->getTick());
 }
开发者ID:MateiGamingYTB,项目名称:PocketEarth,代码行数:17,代码来源:Level.php

示例8: setRedstoneUpdate

 /**
  * @param Vector3 $pos
  * @param int     $delay
  */
 public function setRedstoneUpdate(Vector3 $pos, $delay, $type, $power)
 {
     if ($this->server->getProperty("redstone.enable", true)) {
         $this->updateRedstoneQueueIndex[Level::blockHash($pos->x, $pos->y, $pos->z)][] = ['delay' => $delay, 'type' => $type, 'power' => $power];
         $this->updateRedstoneQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), (int) $delay + $this->server->getTick());
     }
     return;
 }
开发者ID:kakichi,项目名称:ClearSky,代码行数:12,代码来源:Level.php

示例9: setRedstoneUpdate

 /**
  * @param Vector3 $pos
  * @param int     $delay
  */
 public function setRedstoneUpdate(Vector3 $pos, $delay, $type, $power)
 {
     if ($this->server->getProperty("redstone.enable", true)) {
         $hash = Level::blockHash($pos->x, $pos->y, $pos->z);
         if (isset($this->updateRedstoneQueueIndex[$hash])) {
             if ($this->compareRedstone(\end($this->updateRedstoneQueueIndex[$hash]), ['type' => $type, 'power' => $power])) {
                 return false;
             }
         }
         $this->updateRedstoneQueueIndex[$hash][] = ['delay' => $delay, 'type' => $type, 'power' => $power];
         $this->updateRedstoneQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), (int) $delay + $this->server->getTick());
     }
     return;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:18,代码来源:Level.php


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