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


PHP Player::getId方法代码示例

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


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

示例1: internal_onQuit

 private function internal_onQuit(Player $player)
 {
     if (isset($this->sessions[$player->getId()])) {
         $this->sessions[$player->getId()]->close();
         unset($this->sessions[$player->getId()]);
     }
 }
开发者ID:GoneTone,项目名称:WorldEditArt,代码行数:7,代码来源:SessionCollection.php

示例2: __construct

 public function __construct(FullChunk $chunk, CompoundTag $nbt, Player $owner = null)
 {
     if ($owner == null) {
         $this->close();
         return;
     }
     parent::__construct($chunk, $nbt);
     $this->owner = $owner;
     $this->setDataProperty(self::DATA_NO_AI, self::DATA_TYPE_BYTE, 1);
     $this->setDataProperty(self::DATA_SOURCE_UUID, self::DATA_TYPE_LONG, $this->owner->getId());
     $this->setDataProperty(self::DATA_TARGET_UUID, self::DATA_TYPE_LONG, $this->getId());
 }
开发者ID:xpyctum,项目名称:Genisys,代码行数:12,代码来源:FishingHook.php

示例3: setMute

 public function setMute(Player $player, $muted)
 {
     $sub = $this->playerSubs[$player->getId()];
     $original = $sub->muted;
     $sub->muted = $muted;
     return $original;
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:7,代码来源:SessionControl.php

示例4: private_onLogin

 private function private_onLogin(Player $player)
 {
     /** @var string|LoginDataQuery $LoginQuery */
     $LoginQuery = $this->main->getLoginQueryImpl();
     /** @noinspection PhpDeprecationInspection */
     new $LoginQuery($this->main, $player->getId(), $player->getName(), $player->getAddress(), $player->getClientId());
 }
开发者ID:legoboy0215,项目名称:LegionPE-Theta-Base,代码行数:7,代码来源:BaseListener.php

示例5: setFlaming

 public function setFlaming(Player $target)
 {
     $flags = (int) $target->getDataProperty(Player::DATA_FLAGS);
     $flags ^= 1 << Player::DATA_FLAG_ONFIRE;
     $dataProperty = [Player::DATA_FLAGS => [Player::DATA_TYPE_BYTE, $flags]];
     $pk = new SetEntityDataPacket();
     $pk->eid = $target->getId();
     $pk->metadata = $dataProperty;
     Server::broadcastPacket($this->getPlayer()->getLevel()->getPlayers(), $pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
 }
开发者ID:EmreTr1,项目名称:MineCombat,代码行数:10,代码来源:FlameThrower.php

示例6: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if (!$target instanceof Fence) {
         return false;
     }
     foreach ($level->getChunkEntities($target->x >> 4, $target->z >> 4) as $entity) {
         if ($entity->isLeashed()) {
             if ($entity->leadHolder === $player->getId()) {
                 $nbt = new CompoundTag("", ["Pos" => new ListTag("Pos", [new DoubleTag("", $block->getX() + 0.5), new DoubleTag("", $block->getY()), new DoubleTag("", $block->getZ() + 0.5)]), "Motion" => new ListTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new ListTag("Rotation", [new FloatTag("", lcg_value() * 360), new FloatTag("", 0)])]);
                 $level->addEntity($knot = new LeashKnot($level->getChunkAt($target->x >> 4, $target->z >> 4), $nbt));
                 $entity->setLeashHolder($knot);
             }
         }
     }
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:15,代码来源:Leash.php

示例7: __construct

 public function __construct(HereAuth $main, Player $player, AccountInfo $info)
 {
     $this->loadTime = microtime(true);
     $this->main = $main;
     $this->player = $player;
     $this->accountInfo = $info;
     if (!$info->passwordHash) {
         $main->getDataBase()->passesLimit($player->getAddress(), $main->getConfig()->getNested("Registration.RateLimit.Accounts", 3), $main->getConfig()->getNested("Registration.RateLimit.Days", 30) * 86400, $player->getId());
         if (!$main->getConfig()->getNested("ForceRegister.Enabled", true)) {
             // no registration involved
             $this->onAuth();
             $reminder = $main->getConfig()->getNested("ForceRegister.Reminder", "");
             if (strlen($reminder) > 0) {
                 $player->sendMessage($reminder);
             }
             return;
         }
         $this->startRegistration();
         $this->initAppearance();
         return;
     }
     if (!$this->checkMultiFactor()) {
         throw new \Exception("MFA failure");
     }
     if ($info->passwordHash[0] !== "{") {
         if ($info->opts->autoSecret and $player->getClientSecret() === $info->lastSecret and $this->callLogin(HereAuthLoginEvent::METHOD_CLIENT_SECRET)) {
             $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "secret");
             $this->onAuth();
             return;
         }
         if ($info->opts->autoIp and $player->getAddress() === $info->lastIp and $this->callLogin(HereAuthLoginEvent::METHOD_IP)) {
             $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "ip");
             $this->onAuth();
             return;
         }
         if ($info->opts->autoUuid and $player->getUniqueId()->toBinary() === $info->lastUuid and $this->callLogin(HereAuthLoginEvent::METHOD_UUID)) {
             $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "uuid");
             $this->onAuth();
             return;
         }
     }
     $this->state = self::STATE_PENDING_LOGIN;
     $this->player->sendMessage($main->getMessages()->getNested("Login.Query", "Please login"));
     $this->initAppearance();
 }
开发者ID:PEMapModder,项目名称:HereAuth,代码行数:45,代码来源:User.php

示例8: getSession

 public function getSession(Player $player)
 {
     return $this->sessions[$player->getId()];
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:4,代码来源:BulkCommands.php

示例9: hidePlayer

 public function hidePlayer(Player $player)
 {
     $player->despawnFromAll();
     $pk = new RemoveEntityPacket();
     $pk->eid = $player->getId();
     foreach ($player->getLevel()->getPlayers() as $p) {
         $p->dataPacket($pk);
     }
 }
开发者ID:rubbendu91,项目名称:FBlockHunt,代码行数:9,代码来源:Main.php

示例10: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if (($this->getDamage() & 0x8) === 0x8) {
         //Top
         $down = $this->getSide(0);
         if ($down->getId() === $this->getId()) {
             $meta = $down->getDamage() ^ 0x4;
             $this->getLevel()->setBlock($down, Block::get($this->getId(), $meta), true);
             $players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
             if ($player instanceof Player) {
                 unset($players[$player->getId()]);
             }
             $this->level->addSound(new DoorSound($this));
             return true;
         }
         return false;
     } else {
         $this->meta ^= 0x4;
         $this->getLevel()->setBlock($this, $this, true);
         $players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
         if ($player instanceof Player) {
             unset($players[$player->getId()]);
         }
         $this->level->addSound(new DoorSound($this));
     }
     return true;
 }
开发者ID:TylerAndrew,项目名称:Steadfast2,代码行数:27,代码来源:Door.php

示例11: getUserByPlayer

 public function getUserByPlayer(Player $player)
 {
     $id = $player->getId();
     return $this->users[$id] ?? null;
 }
开发者ID:PEMapModder,项目名称:HereAuth,代码行数:5,代码来源:HereAuth.php

示例12: freeChunk

 /**
  * WARNING: Do not use this, it's only for internal use.
  * Changes to this function won't be recorded on the version.
  *
  * @param int    $X
  * @param int    $Z
  * @param Player $player
  */
 public function freeChunk($X, $Z, Player $player)
 {
     unset($this->usedChunks[$index = PHP_INT_SIZE === 8 ? ($X & 4294967295.0) << 32 | $Z & 4294967295.0 : $X . ":" . $Z][$player->getId()]);
     $this->unloadChunkRequest($X, $Z, true);
 }
开发者ID:RedstoneAlmeida,项目名称:Steadfast2,代码行数:13,代码来源:Level.php

示例13: despawnFrom

 /**
  * @param Player $player
  */
 public function despawnFrom(Player $player)
 {
     if (isset($this->hasSpawned[$player->getId()])) {
         $pk = new RemoveEntityPacket();
         $pk->eid = $this->id;
         $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
         unset($this->hasSpawned[$player->getId()]);
     }
 }
开发者ID:Cybertechpp,项目名称:Steadfast2,代码行数:12,代码来源:Entity.php

示例14: getUserByPlayer

 public function getUserByPlayer(Player $player)
 {
     $id = $player->getId();
     return isset($this->users[$id]) ? $this->users[$id] : null;
 }
开发者ID:EpicArtz08999,项目名称:HereAuth,代码行数:5,代码来源:HereAuth.php

示例15: freeChunk

 /**
  * WARNING: Do not use this, it's only for internal use.
  * Changes to this function won't be recorded on the version.
  *
  * @param int    $X
  * @param int    $Z
  * @param Player $player
  */
 public function freeChunk($X, $Z, Player $player)
 {
     unset($this->usedChunks[$index = Level::chunkHash($X, $Z)][$player->getId()]);
     $this->unloadChunkRequest($X, $Z, true);
 }
开发者ID:hlogeon,项目名称:PocketMineJs-MP,代码行数:13,代码来源:Level.php


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