Inheritance: extends Spawnable
 /**
  * Destroy a sign
  * @param Sign $tile - sign tile
  */
 public static function breakSign(Sign $tile)
 {
     $l = $tile->getLevel();
     $l->setBlockIdAt($tile->getX(), $tile->getY(), $tile->getZ(), Block::AIR);
     $l->setBlockDataAt($tile->getX(), $tile->getY(), $tile->getZ(), 0);
     $tile->close();
 }
示例#2
0
 public function registerArea($first, $sec, $level, $price, $expectedY = 64, $rentTime = null, $expectedYaw = 0)
 {
     if (!$level instanceof Level) {
         $level = $this->getServer()->getLevelByName($level);
         if (!$level instanceof Level) {
             return false;
         }
     }
     $expectedY = round($expectedY);
     if ($first[0] > $sec[0]) {
         $tmp = $first[0];
         $first[0] = $sec[0];
         $sec[0] = $tmp;
     }
     if ($first[1] > $sec[1]) {
         $tmp = $first[1];
         $first[1] = $sec[1];
         $sec[1] = $tmp;
     }
     if ($this->checkOverlapping($first, $sec, $level)) {
         return false;
     }
     $price = round($price, 2);
     $centerx = (int) ($first[0] + round(($sec[0] - $first[0]) / 2));
     $centerz = (int) ($first[1] + round(($sec[1] - $first[1]) / 2));
     $x = (int) round($sec[0] - $first[0]);
     $z = (int) round($sec[1] - $first[1]);
     $y = 0;
     $diff = 256;
     $tmpY = 0;
     $lastBlock = 0;
     for (; $y < 127; $y++) {
         $b = $level->getBlock(new Vector3($centerx, $y, $centerz));
         $id = $b->getID();
         $difference = abs($expectedY - $y);
         if ($difference > $diff) {
             // Finding the closest location with player or something
             $y = $tmpY;
             break;
         } else {
             if ($id === 0 and $lastBlock !== 0 or $b->canBeReplaced()) {
                 $tmpY = $y;
                 $diff = $difference;
             }
         }
         $lastBlock = $id;
     }
     if ($y >= 126) {
         $y = $expectedY;
     }
     $meta = floor(($expectedYaw + 180) * 16 / 360 + 0.5) & 0xf;
     $level->setBlock(new Position($centerx, $y, $centerz, $level), Block::get(Item::SIGN_POST, $meta));
     $info = $this->property->query("SELECT seq FROM sqlite_sequence")->fetchArray(SQLITE3_ASSOC);
     $tile = new Sign($level->getChunk($centerx >> 4, $centerz >> 4, false), new CompoundTag(false, ["id" => new StringTag("id", Tile::SIGN), "x" => new IntTag("x", $centerx), "y" => new IntTag("y", $y), "z" => new IntTag("z", $centerz), "Text1" => new StringTag("Text1", ""), "Text2" => new StringTag("Text2", ""), "Text3" => new StringTag("Text3", ""), "Text4" => new StringTag("Text4", "")]));
     $tile->setText($rentTime === null ? "[PROPERTY]" : "[RENT]", "Price : {$price}", "Blocks : " . $x * $z * 128, $rentTime === null ? "Property #" . $info["seq"] : "Time : " . $rentTime . "min");
     $this->property->exec("INSERT INTO Property (price, x, y, z, level, startX, startZ, landX, landZ" . ($rentTime === null ? "" : ", rentTime") . ") VALUES ({$price}, {$centerx}, {$y}, {$centerz}, '{$level->getName()}', {$first['0']}, {$first['1']}, {$sec['0']}, {$sec['1']}" . ($rentTime === null ? "" : ", {$rentTime}") . ")");
     return [$centerx, $y, $centerz];
 }
 /**
  * Add a new 1vs1 sign
  */
 public function addSign(Sign $signTile)
 {
     $signs = $this->config->signs;
     $signs[count($this->signTiles)] = [$signTile->getX(), $signTile->getY(), $signTile->getZ(), $signTile->getLevel()->getName()];
     $this->config->set("signs", $signs);
     $this->config->save();
     array_push($this->signTiles, $signTile);
 }
示例#4
0
 public function blockBreak(BlockBreakEvent $event)
 {
     $block = $event->getBlock();
     if ($block->getId() === $this->data["lucky_block"] && $this->isAllowedWorld($block->getLevel())) {
         $player = $event->getPlayer();
         if (!$player->hasPermission("luckyblock.use")) {
             $player->sendMessage($this->tag . $this->message->get("not_allowed"));
             return;
         }
         $event->setCancelled();
         $player->getLevel()->setBlock($block, new Block(Block::AIR), false, true);
         $rand = new Random();
         switch ($rand->nextRange(1, 12)) {
             case 1:
                 if (!isset($this->data["functions"]["spawnTree"]) || $this->data["functions"]["spawnTree"]) {
                     $type = Sapling::OAK;
                     switch ($rand->nextRange(0, 3)) {
                         case 1:
                             $type = Sapling::BIRCH;
                             break;
                         case 2:
                             $type = Sapling::SPRUCE;
                             break;
                         case 3:
                             $type = Sapling::JUNGLE;
                             break;
                     }
                     if ($player->getLevel()->setBlock($block, new Sapling($type), true, true)) {
                         $player->getLevel()->getBlock($block)->onActivate(new Item(Item::DYE, 15), $player);
                         $player->sendMessage($this->tag . $this->message->get("tree"));
                     }
                     break;
                 }
             case 2:
                 if (!isset($this->data["functions"]["explosion"]) || $this->data["functions"]["explosion"]) {
                     $explosion = new Explosion($block, mt_rand($this->data["explosion_min"], $this->data["explosion_max"]));
                     if ($explosion->explodeA()) {
                         $explosion->explodeB();
                     }
                     $player->sendMessage($this->tag . $this->message->get("explosion"));
                     break;
                 }
             case 3:
                 if (!isset($this->data["functions"]["dropItem"]) || $this->data["functions"]["dropItem"]) {
                     if (mt_rand(0, 1)) {
                         if ($this->itemLoop($player, $block)) {
                             break;
                         }
                     }
                     if (count($this->data["items_dropped"]) === 0) {
                         $item = $this->randItem();
                     } else {
                         $item = $this->data["items_dropped"][mt_rand(0, count($this->data["items_dropped"]) - 1)];
                     }
                     $player->getLevel()->dropItem($block, $item);
                     $player->sendMessage($this->tag . $this->message->get("drop"));
                     break;
                 }
             case 4:
                 if (!isset($this->data["functions"]["bedrock"]) || $this->data["functions"]["bedrock"]) {
                     $player->getLevel()->setBlock($block, new Block(Block::BEDROCK));
                     $p = new Position($block->x, $block->y + 1, $block->z, $block->level);
                     if ($player->getLevel()->getBlock($p)->getId() != Block::AIR) {
                         break;
                     }
                     $block->getLevel()->setBlock($p, Block::get(Item::SIGN_POST));
                     $sign = new Sign($player->getLevel()->getChunk($block->x >> 4, $block->z >> 4), new CompoundTag(false, array(new IntTag("x", (int) $block->x), new IntTag("y", (int) $block->y + 1), new IntTag("z", (int) $block->z), new StringTag("Text1", $this->tag), new StringTag("Text2", $this->message->get("signText")))));
                     $sign->spawnToAll();
                     $player->sendMessage($this->tag . $this->message->get("sign"));
                     break;
                 }
             case 5:
                 if (!isset($this->data["functions"]["prison"]) || $this->data["functions"]["prison"]) {
                     $pos = $event->getPlayer();
                     $pos->x = round($pos->x) + 0.5;
                     $pos->y = round($pos->y);
                     $pos->z = round($pos->z) + 0.5;
                     $player->teleport($pos, $player->getYaw(), $player->getPitch());
                     $arr = [];
                     switch ($rand->nextRange(1, 5)) {
                         case 1:
                             $player->getLevel()->setBlock(new Position($pos->x, $pos->y - 1, $pos->z, $pos->getLevel()), new Block(Block::OBSIDIAN));
                             for ($x = $pos->x - 1; $x <= $pos->x + 1; $x++) {
                                 for ($z = $pos->z - 1; $z <= $pos->z + 1; $z++) {
                                     if (!($x === $pos->x && $z === $pos->z)) {
                                         for ($y = $pos->y; $y <= $pos->y + 2; $y++) {
                                             $player->getLevel()->setBlock(new Position($x, $y, $z, $pos->getLevel()), new Block(Block::OBSIDIAN));
                                         }
                                     }
                                 }
                             }
                             $player->getLevel()->updateAround($pos);
                             $player->sendMessage($this->tag . $this->message->get("prison"));
                             break;
                         case 2:
                             $player->getLevel()->setBlock(new Position($pos->x, $pos->y - 1, $pos->z, $pos->getLevel()), new Block(Block::STILL_LAVA));
                             $player->getLevel()->setBlock(new Position($pos->x, $pos->y - 2, $pos->z, $pos->getLevel()), new Block(Block::GLASS));
                             for ($x = $pos->x - 1; $x <= $pos->x + 1; $x++) {
                                 for ($z = $pos->z - 1; $z <= $pos->z + 1; $z++) {
                                     if (!($x === $pos->x && $z === $pos->z)) {
                                         for ($y = $pos->y; $y <= $pos->y + 2; $y++) {
                                             $player->getLevel()->setBlock(new Position($x, $y, $z, $pos->getLevel()), new Block(Block::IRON_BAR));
                                         }
                                     }
                                 }
                             }
                             $player->getLevel()->updateAround($pos);
                             $player->sendMessage($this->tag . $this->message->get("prison"));
                             break;
                         case 3:
                             $player->getLevel()->setBlock(new Position($pos->x, $pos->y - 1, $pos->z, $pos->getLevel()), new Block(Block::SANDSTONE));
                             for ($x = $pos->x - 1; $x <= $pos->x + 1; $x++) {
                                 for ($z = $pos->z - 1; $z <= $pos->z + 1; $z++) {
                                     if (!($x === $pos->x && $z === $pos->z)) {
                                         for ($y = $pos->y; $y <= $pos->y + 2; $y++) {
                                             $player->getLevel()->setBlock(new Position($x, $y, $z, $pos->getLevel()), new Block(Block::IRON_BAR));
                                         }
                                     }
                                 }
                             }
                             break;
                         case 4:
                             $arr = [["x" => -1, "y" => -1, "z" => -1, "block" => Block::OBSIDIAN], ["x" => -1, "y" => -1, "z" => 0, "block" => Block::OBSIDIAN], ["x" => -1, "y" => -1, "z" => 1, "block" => Block::OBSIDIAN], ["x" => 0, "y" => -1, "z" => -1, "block" => Block::OBSIDIAN], ["x" => 0, "y" => -1, "z" => 0, "block" => Block::OBSIDIAN], ["x" => 0, "y" => -1, "z" => 1, "block" => Block::OBSIDIAN], ["x" => 1, "y" => -1, "z" => -1, "block" => Block::OBSIDIAN], ["x" => 1, "y" => -1, "z" => 0, "block" => Block::OBSIDIAN], ["x" => 1, "y" => -1, "z" => 1, "block" => Block::OBSIDIAN], ["x" => -1, "y" => 0, "z" => -1, "block" => Block::OBSIDIAN], ["x" => -1, "y" => 0, "z" => 0, "block" => Block::OBSIDIAN], ["x" => -1, "y" => 0, "z" => 1, "block" => Block::OBSIDIAN], ["x" => 0, "y" => 0, "z" => -1, "block" => Block::OBSIDIAN], ["x" => 0, "y" => 0, "z" => 0, "block" => Block::STILL_WATER], ["x" => 0, "y" => 0, "z" => 1, "block" => Block::OBSIDIAN], ["x" => 1, "y" => 0, "z" => -1, "block" => Block::OBSIDIAN], ["x" => 1, "y" => 0, "z" => 0, "block" => Block::OBSIDIAN], ["x" => 1, "y" => 0, "z" => 1, "block" => Block::OBSIDIAN], ["x" => 1, "y" => 0, "z" => 1, "block" => Block::OBSIDIAN], ["x" => -1, "y" => 1, "z" => -1, "block" => Block::OBSIDIAN], ["x" => -1, "y" => 1, "z" => 0, "block" => Block::GLASS], ["x" => -1, "y" => 1, "z" => 1, "block" => Block::OBSIDIAN], ["x" => 0, "y" => 1, "z" => -1, "block" => Block::GLASS], ["x" => 0, "y" => 1, "z" => 0, "block" => Block::STILL_WATER], ["x" => 0, "y" => 1, "z" => 1, "block" => Block::GLASS], ["x" => 1, "y" => 1, "z" => -1, "block" => Block::OBSIDIAN], ["x" => 1, "y" => 1, "z" => 0, "block" => Block::GLASS], ["x" => 1, "y" => 1, "z" => 1, "block" => Block::OBSIDIAN], ["x" => -1, "y" => 2, "z" => -1, "block" => Block::OBSIDIAN], ["x" => -1, "y" => 2, "z" => 0, "block" => Block::OBSIDIAN], ["x" => -1, "y" => 2, "z" => 1, "block" => Block::OBSIDIAN], ["x" => 0, "y" => 2, "z" => -1, "block" => Block::OBSIDIAN], ["x" => 0, "y" => 2, "z" => 0, "block" => Block::OBSIDIAN], ["x" => 0, "y" => 2, "z" => 1, "block" => Block::OBSIDIAN], ["x" => 1, "y" => 2, "z" => -1, "block" => Block::OBSIDIAN], ["x" => 1, "y" => 2, "z" => 0, "block" => Block::OBSIDIAN], ["x" => 1, "y" => 2, "z" => 1, "block" => Block::OBSIDIAN]];
                             break;
                         case 5:
                             $arr = [["x" => -1, "y" => 0, "z" => -1, "block" => Block::STILL_LAVA], ["x" => -1, "y" => 0, "z" => 0, "block" => Block::STILL_LAVA], ["x" => -1, "y" => 0, "z" => 1, "block" => Block::STILL_LAVA], ["x" => 0, "y" => 0, "z" => -1, "block" => Block::STILL_LAVA], ["x" => 0, "y" => 0, "z" => 0, "block" => Block::STILL_LAVA], ["x" => 0, "y" => 0, "z" => 1, "block" => Block::STILL_LAVA], ["x" => 1, "y" => 0, "z" => -1, "block" => Block::STILL_LAVA], ["x" => 1, "y" => 0, "z" => 0, "block" => Block::STILL_LAVA], ["x" => 1, "y" => 0, "z" => 1, "block" => Block::STILL_LAVA], ["x" => -1, "y" => 1, "z" => -1, "block" => Block::COBWEB], ["x" => -1, "y" => 1, "z" => 0, "block" => Block::COBWEB], ["x" => -1, "y" => 1, "z" => 1, "block" => Block::COBWEB], ["x" => 0, "y" => 1, "z" => -1, "block" => Block::COBWEB], ["x" => 0, "y" => 1, "z" => 0, "block" => Block::COBWEB], ["x" => 0, "y" => 1, "z" => 1, "block" => Block::COBWEB], ["x" => 1, "y" => 1, "z" => -1, "block" => Block::COBWEB], ["x" => 1, "y" => 1, "z" => 0, "block" => Block::COBWEB], ["x" => 1, "y" => 1, "z" => 1, "block" => Block::COBWEB]];
                             break;
                     }
                     $pos = $player->getPosition();
                     foreach ($arr as $i => $c) {
                         $player->getLevel()->setBlock($pos->add($c["x"], $c["y"], $c["z"]), Block::get($c["block"]), true, true);
                     }
                     break;
                 }
             case 6:
                 if (!isset($this->data["functions"]["chest"]) || $this->data["functions"]["chest"]) {
                     $player->getLevel()->setBlock($block, new Block(Block::CHEST), true, true);
                     $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::CHEST), new IntTag("x", $block->x), new IntTag("y", $block->y), new IntTag("z", $block->z)]);
                     $nbt->Items->setTagType(NBT::TAG_Compound);
                     $tile = Tile::createTile("Chest", $block->getLevel()->getChunk($block->x >> 4, $block->z >> 4), $nbt);
                     if ($tile instanceof Chest) {
                         for ($i = 0; $i <= mt_rand(1, $this->data["max_chest_item"]); $i++) {
                             if (count($this->data["items_dropped"]) === 0) {
                                 $item = $this->randItem();
                             } else {
                                 $item = $this->data["items_dropped"][mt_rand(0, count($this->data["items_dropped"]) - 1)];
                             }
                             $tile->getInventory()->setItem($i, $item);
                         }
                         $player->sendMessage($this->tag . $this->message->get("chest"));
                     }
                     break;
                 }
             case 7:
                 if (!isset($this->data["functions"]["teleport"]) || $this->data["functions"]["teleport"]) {
                     $player->teleport($player->getLevel()->getSpawnLocation(), $player->getYaw(), $player->getPitch());
                     $player->sendMessage($this->tag . $this->message->get("spawn"));
                     break;
                 }
             case 8:
                 if (!isset($this->data["functions"]["potion"]) || $this->data["functions"]["potion"]) {
                     if (count($this->data["potions"])) {
                         $effect = Effect::getEffectByName($this->data["potions"][$rand->nextRange(0, count($this->data["potions"]) - 1)]);
                         $effect->setDuration($rand->nextRange(20, $this->data["max_duration"] * 20));
                         $player->addEffect($effect);
                         $player->sendMessage($this->tag . $this->message->get("effect"));
                     } else {
                         $player->sendMessage($this->tag . $this->message->get("unlucky"));
                     }
                     break;
                 }
             case 9:
                 //exec command
                 if (!isset($this->data["functions"]["execCmd"]) || $this->data["functions"]["execCmd"]) {
                     if (count($this->data["commands"])) {
                         $cmd = $this->data["commands"][$rand->nextRange(0, count($this->data["commands"]) - 1)];
                         $cmd = str_replace(["%PLAYER%", "%X%", "%Y%", "%Z%", "%WORLD%", "%IP%", "%XP%"], [$player->getName(), $player->getX(), $player->getY(), $player->getZ(), $player->getLevel()->getName(), $player->getAddress(), $player->getXpLevel()], $cmd);
                         $this->getServer()->dispatchCommand(new ConsoleCommandSender(), $cmd);
                         $player->sendMessage($this->tag . $this->message->get("command"));
                         break;
                     }
                 }
             case 10:
                 //mob
                 if (!isset($this->data["functions"]["mob"]) || $this->data["functions"]["mob"]) {
                     if (count($this->data["mob"])) {
                         $mob = $this->data["mob"][$rand->nextRange(0, count($this->data["mob"]) - 1)];
                         if ($this->isExistsEntity($mob)) {
                             $nbt = new CompoundTag("", [new ListTag("Pos", [new DoubleTag("", $block->getX()), new DoubleTag("", $block->getY()), new DoubleTag("", $block->getZ())]), new ListTag("Rotation", [new FloatTag("", $player->getYaw()), new FloatTag("", $player->getPitch())]), new StringTag("CustomName", $this->tag)]);
                             $entity = Entity::createEntity($mob, $player->getLevel()->getChunk($block->getX() >> 4, $block->getZ() >> 4), $nbt);
                             if ($entity instanceof Entity) {
                                 $entity->spawnToAll();
                                 $this->getServer()->getScheduler()->scheduleDelayedTask(new TaskExplodeMob($this, $entity, mt_rand($this->data["explosion_min"], $this->data["explosion_max"])), 20 * mt_rand(1, $this->data["mob_explosion_delay"]));
                                 $player->sendMessage($this->tag . $this->message->get("mob"));
                                 break;
                             }
                         }
                     }
                 }
             case 11:
                 if (!isset($this->data["functions"]["lightning"]) || $this->data["functions"]["lightning"]) {
                     $player->getLevel()->spawnLightning($player);
                     $player->sendMessage($this->tag . $this->message->get("lightning"));
                     break;
                 }
             case 12:
                 $player->sendMessage($this->tag . $this->message->get("unlucky"));
                 break;
         }
         $player->getLevel()->save();
     }
 }
 public function matches(Sign $sign)
 {
     return $sign->getText()[$this->matchingLine - 1] == $this->matches;
 }
 public function SignSpawn($text, $pos)
 {
     if ($this->getServer()->getDefaultLevel()->isChunkGenerated($pos[0], $pos[2])) {
         $this->getServer()->getDefaultLevel()->generateChunk($pos[0], $pos[1]);
     }
     $chunk = $this->getServer()->getDefaultLevel()->getChunk($pos[0] >> 4, $pos[2] >> 4, true);
     $nbt = new Compound("", [new String("Text1", $text[0]), new String("Text2", $text[1]), new String("Text3", $text[2]), new String("Text4", $text[3]), new String("id", Tile::SIGN), new Int("x", (int) $pos[0]), new Int("y", (int) $pos[1]), new Int("z", (int) $pos[2])]);
     if (!$chunk instanceof FullChunk) {
         break;
     }
     $entities = $this->getServer()->getDefaultLevel()->getEntities();
     foreach ($entities as $tile) {
         if (!$tile instanceof Tile) {
             continue;
         }
         if ($tile->x != $pos[0] or $tile->y != $pos[1] or $tile->z != $pos[2]) {
             continue;
         }
         $tile->close();
     }
     $id = $this->list[$pos[0] . "." . $pos[1] . "." . $pos[2]]['id'];
     $damage = $this->list[$pos[0] . "." . $pos[1] . "." . $pos[2]]['damage'];
     $this->getServer()->getDefaultLevel()->setBlock(new Vector3($pos[0], $pos[1], $pos[2]), Block::get($id, $damage), false, true);
     $sign = new Sign($chunk, $nbt);
     $sign->saveNBT();
     $this->getServer()->getDefaultLevel()->addTile($sign);
 }
示例#7
0
 public function onCommand(CommandSender $player, Command $command, $label, array $args)
 {
     /* SEND HELP */
     if (!isset($args[3])) {
         $player->sendMessage(TextFormat::DARK_AQUA . "/signgen <x> <y> <z> <world> <id> <meta> <text>");
         return true;
     }
     /* SET X Y Z */
     $x = (int) $args[0];
     $y = (int) $args[1];
     $z = (int) $args[2];
     /* SET WORLD */
     $world = $this->getServer()->getLevelByName($args[3]);
     if (!$world instanceof Level) {
         $world = $this->getServer()->getDefaultLevel();
     }
     /* SET ID AND DAMAGE */
     $id = $args[4];
     $damage = $args[5];
     /* SET TEXT */
     for ($i = 0; $i <= 5; $i++) {
         array_shift($args);
     }
     $text = implode(" ", $args);
     $text = explode("\\n", $text);
     if (!isset($text[1])) {
         $text[1] = "";
     }
     if (!isset($text[2])) {
         $text[2] = "";
     }
     if (!isset($text[3])) {
         $text[3] = "";
     }
     /* SET CHUNK */
     if ($world->isChunkGenerated($x, $z)) {
         $world->generateChunk($x, $z);
     }
     $chunk = $world->getChunk($x >> 4, $z >> 4, true);
     if (!$chunk instanceof FullChunk) {
         $player->sendMessage(TextFormat::DARK_AQUA . "[SignGeneration] WRONG CHUNK PROBLEM EXIST");
         return true;
     }
     /* SET NBT */
     $nbt = new Compound("", [new String("Text1", $text[0]), new String("Text2", $text[1]), new String("Text3", $text[2]), new String("Text4", $text[3]), new String("id", Tile::SIGN), new Int("x", (int) $x), new Int("y", (int) $y), new Int("z", (int) $z)]);
     /* DELETE OVERLAP TILE */
     $entities = $world->getEntities();
     foreach ($entities as $tile) {
         if (!$tile instanceof Tile) {
             continue;
         }
         if ($tile->x != $x or $tile->y != $y or $tile->z != $z) {
             continue;
         }
         $tile->close();
     }
     /* SET SIGN BLOCK */
     $world->setBlock(new Vector3($x, $y, $z), Block::get($id, $damage), false, true);
     $sign = new Sign($chunk, $nbt);
     $sign->saveNBT();
     $world->addTile($sign);
     $player->sendMessage(TextFormat::DARK_AQUA . "[SignGeneration] COMPLETE!");
     return true;
 }
 public function resetSign(Sign $sign)
 {
     $text = $sign->getText();
     if (TextFormat::clean(strtolower(trim($text[0]))) === strtolower(trim($this->sign->get("sign_final_change")))) {
         $sign->setText($text[0] = "Sign Has been", $text[1] = "deleted from", $text[2] = "SignStatus", $text[3] = "updates.");
         return true;
     } else {
         return false;
     }
 }
示例#9
0
 public function addDS(Sign $sign, $lines, $interval = 20, $scroll = 1)
 {
     $lengths = "";
     $clone = $lines;
     if (count($clone) % 2) {
         $clone[] = "";
     }
     for ($i = 0; $i < count($clone) * 2; $i++) {
         $length0 = strlen($clone[$i * 2]);
         $length1 = strlen($clone[$i * 2 + 1]);
         $lengths .= chr($length0 << 4 + $length1);
     }
     $op = $this->getDb($sign->getLevel())->prepare("INSERT INTO signs (id, x, y, z, lengths, " . "texts, intv, scroller) VALUES (:id, :x, :y, :z, :lengths, :texts, :intv, :scroller);");
     $op->bindValue(":id", $this->ids["signs"]++);
     $op->bindValue(":x", $sign->x);
     $op->bindValue(":y", $sign->y);
     $op->bindValue(":z", $sign->z);
     $op->bindValue(":lengths", $lengths);
     $op->bindValue(":texts", implode("", $lines));
     $op->bindValue(":intv", $interval);
     $op->bindValue(":scroller", $scroll);
     $op->execute();
 }