setText() публичный Метод

public setText ( $line1 = "", $line2 = "", $line3 = "", $line4 = "" )
Пример #1
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];
 }
Пример #2
0
 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;
     }
 }