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


PHP UUID::fromData方法代码示例

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


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

示例1: aht

 function aht(dgar $E)
 {
     $B = $E->getPlayer();
     if ($B->pitch > 87 && $E->isSneaking()) {
         $D = $B->getName();
         if (isset($this->link[$B->getName()])) {
             return true;
         }
         $C = bcadd("1095216660480", mt_rand(0, 0x7fffffff));
         $L = $B->getSkinData();
         $I = $B->getName() . "'s chair";
         $K = UUID::fromData($C, $L, $I);
         $A = new faeafgv();
         $A->uuid = $K;
         $A->username = $I;
         $A->eid = $C;
         $A->x = $B->x;
         $A->y = $B->y - 3;
         $A->z = $B->z;
         $A->speedX = 0;
         $A->speedY = 0;
         $A->speedZ = 0;
         $A->yaw = 0;
         $A->pitch = 0;
         $A->item = Item::get(0, 0);
         $A->metadata = [0 => [0, 32], 1 => [1, 300], 2 => [4, ""], 3 => [0, 1], 4 => [0, 0], 15 => [0, 0]];
         Server::broadcastPacket(Server::getInstance()->getOnlinePlayers(), $A->setChannel(6));
         $this->uid[$C] = $K;
         $this->rhaethat($A->eid, $B);
     }
 }
开发者ID:moinngmg,项目名称:Seat,代码行数:31,代码来源:Main.php

示例2: initEntity

 protected function initEntity()
 {
     $this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false);
     $this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0]);
     $this->inventory = new PlayerInventory($this);
     if ($this instanceof Player) {
         $this->addWindow($this->inventory, 0);
     }
     if (!$this instanceof Player) {
         if (isset($this->namedtag->NameTag)) {
             $this->setNameTag($this->namedtag["NameTag"]);
         }
         if (isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof Compound) {
             $this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Name"] > 0);
         }
         $this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag());
     }
     if (isset($this->namedtag->Inventory) and $this->namedtag->Inventory instanceof Enum) {
         foreach ($this->namedtag->Inventory as $item) {
             if ($item["Slot"] >= 0 and $item["Slot"] < 9) {
                 //Hotbar
                 $this->inventory->setHotbarSlotIndex($item["Slot"], isset($item["TrueSlot"]) ? $item["TrueSlot"] : -1);
             } elseif ($item["Slot"] >= 100 and $item["Slot"] < 104) {
                 //Armor
                 $this->inventory->setItem($this->inventory->getSize() + $item["Slot"] - 100, NBT::getItemHelper($item));
             } else {
                 $this->inventory->setItem($item["Slot"] - 9, NBT::getItemHelper($item));
             }
         }
     }
     parent::initEntity();
 }
开发者ID:starterdragon,项目名称:ClearSky,代码行数:32,代码来源:Human.php

示例3: __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

示例4: initEntity

 protected function initEntity()
 {
     $this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);
     $this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0], false);
     $inventoryContents = $this->namedtag->Inventory ?? null;
     $this->inventory = new PlayerInventory($this, $inventoryContents);
     //Virtual inventory for desktop GUI crafting and anti-cheat transaction processing
     $this->floatingInventory = new FloatingInventory($this);
     if ($this instanceof Player) {
         $this->addWindow($this->inventory, 0);
     } else {
         if (isset($this->namedtag->NameTag)) {
             $this->setNameTag($this->namedtag["NameTag"]);
         }
         if (isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof CompoundTag) {
             $this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Name"]);
         }
         $this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag());
     }
     if (isset($this->namedtag->Inventory) and $this->namedtag->Inventory instanceof ListTag) {
         foreach ($this->namedtag->Inventory as $item) {
             if ($item["Slot"] >= 0 and $item["Slot"] < 9) {
                 //Hotbar
                 $this->inventory->setHotbarSlotIndex($item["Slot"], isset($item["TrueSlot"]) ? $item["TrueSlot"] : -1);
             } elseif ($item["Slot"] >= 100 and $item["Slot"] < 104) {
                 //Armor
                 $this->inventory->setItem($this->inventory->getSize() + $item["Slot"] - 100, ItemItem::nbtDeserialize($item));
             } else {
                 $this->inventory->setItem($item["Slot"] - 9, ItemItem::nbtDeserialize($item));
             }
         }
     }
     parent::initEntity();
     if (!isset($this->namedtag->foodLevel) or !$this->namedtag->foodLevel instanceof IntTag) {
         $this->namedtag->foodLevel = new IntTag("foodLevel", $this->getFood());
     } else {
         $this->setFood($this->namedtag["foodLevel"]);
     }
     if (!isset($this->namedtag->foodExhaustionLevel) or !$this->namedtag->foodExhaustionLevel instanceof IntTag) {
         $this->namedtag->foodExhaustionLevel = new FloatTag("foodExhaustionLevel", $this->getExhaustion());
     } else {
         $this->setExhaustion($this->namedtag["foodExhaustionLevel"]);
     }
     if (!isset($this->namedtag->foodSaturationLevel) or !$this->namedtag->foodSaturationLevel instanceof IntTag) {
         $this->namedtag->foodSaturationLevel = new FloatTag("foodSaturationLevel", $this->getSaturation());
     } else {
         $this->setSaturation($this->namedtag["foodSaturationLevel"]);
     }
     if (!isset($this->namedtag->foodTickTimer) or !$this->namedtag->foodTickTimer instanceof IntTag) {
         $this->namedtag->foodTickTimer = new IntTag("foodTickTimer", $this->foodTickTimer);
     } else {
         $this->foodTickTimer = $this->namedtag["foodTickTimer"];
     }
     if (!isset($this->namedtag->XpLevel) or !$this->namedtag->XpLevel instanceof IntTag) {
         $this->namedtag->XpLevel = new IntTag("XpLevel", $this->getXpLevel());
     } else {
         $this->setXpLevel($this->namedtag["XpLevel"]);
     }
     if (!isset($this->namedtag->XpP) or !$this->namedtag->XpP instanceof FloatTag) {
         $this->namedtag->XpP = new FloatTag("XpP", $this->getXpProgress());
     }
     if (!isset($this->namedtag->XpTotal) or !$this->namedtag->XpTotal instanceof IntTag) {
         $this->namedtag->XpTotal = new IntTag("XpTotal", $this->totalXp);
     } else {
         $this->totalXp = $this->namedtag["XpTotal"];
     }
     if (!isset($this->namedtag->XpSeed) or !$this->namedtag->XpSeed instanceof IntTag) {
         $this->namedtag->XpSeed = new IntTag("XpSeed", $this->xpSeed ?? ($this->xpSeed = mt_rand(PHP_INT_MIN, PHP_INT_MAX)));
     } else {
         $this->xpSeed = $this->namedtag["XpSeed"];
     }
 }
开发者ID:robske110,项目名称:ClearSky,代码行数:72,代码来源:Human.php

示例5: registerRecipe

 /**
  * @param Recipe $recipe
  */
 public function registerRecipe(Recipe $recipe)
 {
     $recipe->setId(UUID::fromData(++self::$RECIPE_COUNT, $recipe->getResult()->getId(), $recipe->getResult()->getDamage(), $recipe->getResult()->getCount(), $recipe->getResult()->getCompoundTag()));
     if ($recipe instanceof ShapedRecipe) {
         $this->registerShapedRecipe($recipe);
     } elseif ($recipe instanceof ShapelessRecipe) {
         $this->registerShapelessRecipe($recipe);
     } elseif ($recipe instanceof FurnaceRecipe) {
         $this->registerFurnaceRecipe($recipe);
     } elseif ($recipe instanceof BrewingRecipe) {
         $this->registerBrewingRecipe($recipe);
     }
 }
开发者ID:MattWAnderson,项目名称:ImagicalMine,代码行数:16,代码来源:CraftingManager.php

示例6: initEntity

 protected function initEntity()
 {
     $this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);
     $this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0], false);
     $inventoryContents = $this->namedtag->Inventory ?? null;
     $this->inventory = new PlayerInventory($this, $inventoryContents);
     //Virtual inventory for desktop GUI crafting and anti-cheat transaction processing
     $this->floatingInventory = new FloatingInventory($this);
     if ($this instanceof Player) {
         $this->addWindow($this->inventory, 0);
     } else {
         if (isset($this->namedtag->NameTag)) {
             $this->setNameTag($this->namedtag["NameTag"]);
         }
         if (isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof CompoundTag) {
             $this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Name"]);
         }
         $this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag());
     }
     parent::initEntity();
     if (!isset($this->namedtag->foodLevel) or !$this->namedtag->foodLevel instanceof IntTag) {
         $this->namedtag->foodLevel = new IntTag("foodLevel", $this->getFood());
     } else {
         $this->setFood($this->namedtag["foodLevel"]);
     }
     if (!isset($this->namedtag->foodExhaustionLevel) or !$this->namedtag->foodExhaustionLevel instanceof IntTag) {
         $this->namedtag->foodExhaustionLevel = new FloatTag("foodExhaustionLevel", $this->getExhaustion());
     } else {
         $this->setExhaustion($this->namedtag["foodExhaustionLevel"]);
     }
     if (!isset($this->namedtag->foodSaturationLevel) or !$this->namedtag->foodSaturationLevel instanceof IntTag) {
         $this->namedtag->foodSaturationLevel = new FloatTag("foodSaturationLevel", $this->getSaturation());
     } else {
         $this->setSaturation($this->namedtag["foodSaturationLevel"]);
     }
     if (!isset($this->namedtag->foodTickTimer) or !$this->namedtag->foodTickTimer instanceof IntTag) {
         $this->namedtag->foodTickTimer = new IntTag("foodTickTimer", $this->foodTickTimer);
     } else {
         $this->foodTickTimer = $this->namedtag["foodTickTimer"];
     }
     if (!isset($this->namedtag->XpLevel) or !$this->namedtag->XpLevel instanceof IntTag) {
         $this->namedtag->XpLevel = new IntTag("XpLevel", 0);
     }
     $this->setXpLevel($this->namedtag["XpLevel"]);
     if (!isset($this->namedtag->XpP) or !$this->namedtag->XpP instanceof FloatTag) {
         $this->namedtag->XpP = new FloatTag("XpP", 0);
     }
     $this->setXpProgress($this->namedtag["XpP"]);
     if (!isset($this->namedtag->XpTotal) or !$this->namedtag->XpTotal instanceof IntTag) {
         $this->namedtag->XpTotal = new IntTag("XpTotal", 0);
     }
     $this->totalXp = $this->namedtag["XpTotal"];
     if (!isset($this->namedtag->XpSeed) or !$this->namedtag->XpSeed instanceof IntTag) {
         $this->namedtag->XpSeed = new IntTag("XpSeed", mt_rand(PHP_INT_MIN, PHP_INT_MAX));
     }
     $this->xpSeed = $this->namedtag["XpSeed"];
 }
开发者ID:kniffo80,项目名称:Genisys,代码行数:57,代码来源:Human.php

示例7: getMachineUniqueId

 /**
  * Gets this machine / server instance unique ID
  * Returns a hash, the first 32 characters (or 16 if raw)
  * will be an identifier that won't change frequently.
  * The rest of the hash will change depending on other factors.
  *
  * @param string $extra optional, additional data to identify the machine
  *
  * @return UUID
  */
 public static function getMachineUniqueId($extra = "")
 {
     if (self::$serverUniqueId !== null and $extra === "") {
         return self::$serverUniqueId;
     }
     $machine = php_uname("a");
     $machine .= file_exists("/proc/cpuinfo") ? implode(preg_grep("/(model name|Processor|Serial)/", file("/proc/cpuinfo"))) : "";
     $machine .= sys_get_temp_dir();
     $machine .= $extra;
     $os = Utils::getOS();
     if ($os === "win") {
         @exec("ipconfig /ALL", $mac);
         $mac = implode("\n", $mac);
         if (preg_match_all("#Physical Address[. ]{1,}: ([0-9A-F\\-]{17})#", $mac, $matches)) {
             foreach ($matches[1] as $i => $v) {
                 if ($v == "00-00-00-00-00-00") {
                     unset($matches[1][$i]);
                 }
             }
             $machine .= implode(" ", $matches[1]);
             //Mac Addresses
         }
     } elseif ($os === "linux") {
         if (file_exists("/etc/machine-id")) {
             $machine .= file_get_contents("/etc/machine-id");
         } else {
             @exec("ifconfig", $mac);
             $mac = implode("\n", $mac);
             if (preg_match_all("#HWaddr[ \t]{1,}([0-9a-f:]{17})#", $mac, $matches)) {
                 foreach ($matches[1] as $i => $v) {
                     if ($v == "00:00:00:00:00:00") {
                         unset($matches[1][$i]);
                     }
                 }
                 $machine .= implode(" ", $matches[1]);
                 //Mac Addresses
             }
         }
     } elseif ($os === "android") {
         $machine .= @file_get_contents("/system/build.prop");
     } elseif ($os === "mac") {
         $machine .= `system_profiler SPHardwareDataType | grep UUID`;
     }
     $data = $machine . PHP_MAXPATHLEN;
     $data .= PHP_INT_MAX;
     $data .= PHP_INT_SIZE;
     $data .= get_current_user();
     foreach (get_loaded_extensions() as $ext) {
         $data .= $ext . ":" . phpversion($ext);
     }
     $uuid = UUID::fromData($machine, $data);
     if ($extra === "") {
         self::$serverUniqueId = $uuid;
     }
     return $uuid;
 }
开发者ID:psh3253,项目名称:PocketMine-MP_Windows,代码行数:66,代码来源:Utils.php


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