Iam getting the text from a database and then setting it as floating text CODE BELOW: PHP: public function loadFloatingText() { foreach ($this->getCrates() as $crate){ $loc = $this->getLocation($crate); $level = $this->plugin->getServer()->getLevelByName("stop"); $this->plugin->getServer()->loadLevel("stop"); $x = $loc["{$crate}x"] + 0.5; //+ to center to block $y = $loc["{$crate}y"] + 1; //+ to center to block $z = $loc["{$crate}z"] + 0.5; //+ to center to block $display = $this->getDisplay($crate); //Display name $hologram = $this->getHologram($crate); //ex. "Right click to open crate\nLeft click to preview rewards" $level->addParticle(new FloatingTextParticle(new Vector3($x, $y, $z), $hologram, $display)); } } PHP: public function getHologram(string $crate) : string { $array = $this->crate->query("SELECT hologram FROM crates WHERE crate = '$crate';"); $result = $array->fetchArray(SQLITE3_ASSOC); return (string)$result['hologram'] ?? "Test"; }
That didnt work but this did PHP: public function loadFloatingText() { foreach ($this->getCrates() as $crate){ $loc = $this->getLocation($crate); $level = $this->plugin->getServer()->getLevelByName("stop"); $this->plugin->getServer()->loadLevel("stop"); $x = $loc["{$crate}x"] + 0.5; //+ to center to block $y = $loc["{$crate}y"] + 1; //+ to center to block $z = $loc["{$crate}z"] + 0.5; //+ to center to block $display = $this->getDisplay($crate); //Display name $hologram = $this->getHologram($crate); //ex. "Right click to open crate\nLeft click to preview rewards" $level->addParticle(new FloatingTextParticle(new Vector3($x, $y, $z), str_replace("{line}", TextFormat::EOL, $hologram), $display)); } } thank you for the help!