本文整理汇总了PHP中pocketmine\Player::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::getID方法的具体用法?PHP Player::getID怎么用?PHP Player::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::getID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: spawnTo
public function spawnTo(Player $player)
{
if ($player instanceof DesktopPlayer) {
if ($this !== $player and $this->spawned === true and $player->getLevel() === $this->getLevel() and $player->canSee($this)) {
$this->hasSpawned[$player->getID()] = $player;
$pk = new SpawnPlayerPacket();
if ($player->getRemoveFormat()) {
$pk->name = TextFormat::clean($this->nameTag);
} else {
$pk->name = $this->nameTag;
}
$pk->eid = $this->getID();
$pk->uuid = $this->bigBrother_formatedUUID;
$pk->x = $this->x;
$pk->z = $this->y;
$pk->y = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->item = $this->inventory->getItemInHand()->getID();
$pk->metadata = $this->getData();
$pk->data = $this->bigBrother_properties;
$player->putRawPacket($pk);
$pk = new EntityTeleportPacket();
$pk->eid = $this->getID();
$pk->x = $this->x;
$pk->z = $this->y;
$pk->y = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$player->putRawPacket($pk);
$pk = new SetEntityMotionPacket();
$pk->eid = $this->getID();
$pk->speedX = $this->motionX;
$pk->speedY = $this->motionY;
$pk->speedZ = $this->motionZ;
$player->dataPacket($pk);
$this->inventory->sendHeldItem($player);
$this->inventory->sendArmorContents($player);
}
} else {
parent::spawnTo($player);
}
}
示例2: 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);
}
示例3: despawnFrom
public function despawnFrom(Player $player)
{
if (isset($this->hasSpawned[$player->getID()])) {
$pk = new RemovePlayerPacket();
$pk->eid = $this->id;
$pk->clientID = 0;
$player->dataPacket($pk);
unset($this->hasSpawned[$player->getID()]);
}
}
示例4: onLoggedIn
public function onLoggedIn(Player $player)
{
if (isset($this->loggedIn[$player->getID()])) {
return;
}
$f = $this->getFList()->getFaction($player);
if (!$f instanceof Faction) {
return;
}
$f->setActiveNow();
$this->loggedIn[$player->getID()] = true;
}
示例5: onActivate
public function onActivate(Item $item, Player $player = null)
{
if (($this->meta & 0x8) === 0x8) {
//Top
$down = $this->getSide(0);
if ($down->getID() === $this->id) {
$meta = $down->getDamage() ^ 0x4;
$this->getLevel()->setBlock($down, Block::get($this->id, $meta), true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
if ($player instanceof Player) {
unset($players[$player->getID()]);
}
$pk = new LevelEventPacket();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->evid = 1003;
$pk->data = 0;
Server::broadcastPacket($players, $pk);
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()]);
}
$pk = new LevelEventPacket();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->evid = 1003;
$pk->data = 0;
Server::broadcastPacket($players, $pk);
}
return true;
}
示例6: getAnchor
/**
* @param Player $player
* @return bool|Position
*/
public function getAnchor(Player $player)
{
return isset($this->anchors[$player->getID()]) ? $this->anchors[$player->getID()] : false;
}
示例7: offset
public static function offset(Player $player)
{
return $player->getID();
}
示例8: despawnFrom
public function despawnFrom(Player $player)
{
if (isset($this->hasSpawned[$player->getID()])) {
$this->entityevent_pk->eid = $this->id;
$this->entityevent_pk->event = 3;
if ($player != null) {
$player->dataPacket($this->entityevent_pk);
$this->removeentity_pk->eid = $this->id;
$this->server->getScheduler()->scheduleDelayedTask(new CallbackTask([$player, "dataPacket"], [$this->removeentity_pk]), 23);
}
unset($this->hasSpawned[$player->getID()]);
}
}
示例9: offset
private function offset(Player $player)
{
return $player->getID();
}
示例10: finalizePlayer
public function finalizePlayer(Player $player, $isQuit)
{
if (isset($this->stack[$id = $player->getID()])) {
unset($this->stack[$id]);
// avoid bugs if the entity ID gets reused
if ($isQuit) {
$this->getLogger()->alert($player->getDisplayName() . " has quit, so his recording macro has been discarded.");
} else {
$this->getLogger()->alert("Discarding recording macro of " . $player->getDisplayName() . " due to plugin disable.");
$player->sendMessage("Your recording macro has been discarded due to SimpleMacros being disabled.");
}
}
if (isset($this->paused[$id])) {
unset($this->stack[$id]);
}
if (isset($this->atts[$id])) {
unset($this->atts[$id]);
}
}