public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null) { if ($face !== 0) { $nbt = new CompoundTag("", ["id" => new StringTag("id", Tile::SIGN), "x" => new IntTag("x", $block->x), "y" => new IntTag("y", $block->y), "z" => new IntTag("z", $block->z), "Text1" => new StringTag("Text1", ""), "Text2" => new StringTag("Text2", ""), "Text3" => new StringTag("Text3", ""), "Text4" => new StringTag("Text4", "")]); if ($player !== null) { $nbt->Creator = new StringTag("Creator", $player->getRawUniqueId()); } if ($item->hasCustomBlockData()) { foreach ($item->getCustomBlockData() as $key => $v) { $nbt->{$key} = $v; } } if ($face === 1) { $this->meta = floor(($player->yaw + 180) * 16 / 360 + 0.5) & 0xf; $this->getLevel()->setBlock($block, Block::get(Item::SIGN_POST, $this->meta), true); Tile::createTile(Tile::SIGN, $this->getLevel()->getChunk($block->x >> 4, $block->z >> 4), $nbt); return true; } else { $this->meta = $face; $this->getLevel()->setBlock($block, Block::get(Item::WALL_SIGN, $this->meta), true); Tile::createTile(Tile::SIGN, $this->getLevel()->getChunk($block->x >> 4, $block->z >> 4), $nbt); return true; } } return false; }
/** * @param Player $player */ public function showPlayer(Player $player) { if ($player === $this) { return; } unset($this->hiddenPlayers[$player->getRawUniqueId()]); if ($player->isOnline()) { $player->spawnTo($this); } }
public function removeOnlinePlayer(Player $player) { if (isset($this->playerList[$player->getRawUniqueId()])) { unset($this->playerList[$player->getRawUniqueId()]); $pk = new PlayerListPacket(); $pk->type = PlayerListPacket::TYPE_REMOVE; $pk->entries[] = [$player->getUniqueId()]; Server::broadcastPacket($this->playerList, $pk); } }
protected static function defaultLoginData($uid, Player $player) { $name = $player->getName(); $ip = $player->getAddress(); return ["uid" => $uid, "name" => $name, "nicks" => "|{$name}|", "lastip" => "", "status" => Settings::STATUS_OFFLINE, "lastses" => Settings::$LOCALIZE_CLASS, "authuuid" => $player->getRawUniqueId(), "coins" => 0.0, "hash" => str_repeat("0", 128), "pwprefix" => "", "pwlen" => 0, "registration" => time(), "laston" => time(), "ontime" => 0, "config" => Settings::CONFIG_DEFAULT_VALUE, "lastgrind" => 0, "rank" => 0, "warnpts" => 0, "lastwarn" => 0, "tid" => -1, "teamrank" => -1, "teamjoin" => 0, "teampts" => 0, "teamname" => "", "ignorelist" => ",", "iphist" => ",{$ip},", "isnew" => true, "email" => self::EMAIL_UNVERIFIED, "friends" => [Friend::FRIEND_ENEMY => [], Friend::FRIEND_ACQUAINTANCE => [], Friend::FRIEND_GOOD_FRIEND => [], Friend::FRIEND_BEST_FRIEND => []], "langs" => [], "purchases" => [], "channels" => [], "kitrowsarray" => []]; }