Hello, I want to do floating text in my server i worked on it i can spawn it but i cant Respawn it... I have trying to do it with other code in github So It dont work....I specify im not a pro.. Code execute onJoin PHP: public function onPlayerJoin(PlayerJoinEvent $event){ $pl = $event->getPlayer(); $level= $event->getPlayer()->getLevel(); $cfg = $this->config; $pos11 = $cfg->get("pos1"); $pos22 = $cfg->get("pos2"); $pos33 = $cfg->get("pos3"); $pos44 = $cfg->get("pos4"); $pos55 = $cfg->get("pos5"); $pos66 = $cfg->get("pos6"); $pos77 = $cfg->get("pos7"); $pos88 = $cfg->get("pos8"); $pos99 = $cfg->get("pos9"); $text1 = $this->repl($cfg->get("text1")); $text2 = $this->repl($cfg->get("text2")); $text3 = $this->repl($cfg->get("text3")); $text4 = $cfg->get("text4"); $text5 = $cfg->get("text5"); $text6 = $cfg->get("text6"); $text7 = $cfg->get("text7"); $text8 = $cfg->get("text8"); $text9 = $cfg->get("text9"); $pos1 = new Vector3($pos11); $pos2 = new Vector3($pos22); $pos3 = new Vector3($pos33); $pos4 = new Vector3($pos44); $pos5 = new Vector3($pos55); $pos6 = new Vector3($pos66); $pos7 = new Vector3($pos77); $pos8 = new vector3($pos88); $pos9 = new Vector3($pos99);$this->ftp = array( 1=> $level->addParticle(new FloatingTextParticle($pos1,$text1)), 2=> $level->addParticle(new FloatingTextParticle($pos2,$text2)), 3=> $level->addParticle(new FloatingTextParticle($pos3,$text3)), 4=>$level->addParticle(new FloatingTextParticle($pos4->add(0.5, 0.0, 0.5),$text4)), 5=> $level->addParticle(new FloatingTextParticle($pos5->add(0.5, 0.0, 0.5),$text5)), 6=> $level->addParticle(new FloatingTextParticle($pos6->add(0.5, 0.0, 0.5),$text6)), 7=> $level->addParticle(new FloatingTextParticle($pos7->add(0.5, 0.0, 0.5),$text7)), 8=> $level->addParticle(new FloatingTextParticle($pos8->add(0.5, 0.0, 0.5),$text8)), 9=> $level->addParticle(new FloatingTextParticle($pos9->add(0.5, 0.0, 0.5),$text9))); } Now that is executed in the event on chat PHP: if(preg_match("/^!act$/",$mess)){ $ev->setCancelled(true); if(empty($this->ftp)) return $sender->sendMessage("empty"); for($i=1; $i<10; $i++){ $this->ftp[$i]->setInvisible(false); //193 }$player->sendMessage("reactivated"); } The error [Server thread/CRITICAL]: Error: "Call to a member function setInvisible() on null" (EXCEPTION) in "EnkoraCore/src/enkora/Main" at line 193 Thanks for your help and im not a pro
I think, that you need add FloatingTextParticle class to $this->ftp, but no null Function 'addParticle' return null Spoiler: Level::addParticle() PHP: public function addParticle(Particle $particle, array $players = null){ $pk = $particle->encode(); if($players === null){ if($pk !== null){ if(!is_array($pk)){ $this->addChunkPacket($particle->x >> 4, $particle->z >> 4, $pk); }else{ foreach($pk as $e){ $this->addChunkPacket($particle->x >> 4, $particle->z >> 4, $e); } } } }else{ if($pk !== null){ if(!is_array($pk)){ $this->server->broadcastPacket($players, $pk); }else{ $this->server->batchPackets($players, $pk, false); } } } } Spoiler: Something like this PHP: $this->ftp = array( 1=> new FloatingTextParticle($pos1,$text1), 2=> new FloatingTextParticle($pos2,$text2), 3=> new FloatingTextParticle($pos3,$text3), ...);foreach ($this->ftp as $particle) { $level->addParticle($particle);}