/** * 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(); }
/** * 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); }
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(); }