Hi I've tried to add and removes an FloatingTextParticl but it doesnt work what is wrong? PHP: $o = $this->getOwner();$level = $o->getServer()->getLevelByName("world");if($o->particle == 0){$part = new FloatingTextParticle(new Vector3(910, 11, 962),"", "§aPlatziere eine Kiste auf\n §adem §6Diamantblock");$part->setInvisible();$part1 = new FloatingTextParticle(new Vector3(910, 11, 962),"", "§ePlatziere eine Kiste auf\n §adem §6Diamantblock");$level->addParticle($part1);$o->particle = 1;}else{$part1 = new FloatingTextParticle(new Vector3(910, 11, 962),"", "§ePlatziere eine Kiste auf\n §adem §6Diamantblock");$part1->setInvisible();$part = new FloatingTextParticle(new Vector3(910, 11, 962),"", "§aPlatziere eine Kiste auf\n §adem §6Diamantblock");$level->addParticle($part);$o->particle = 0;}//Before you ask YEAH its a TASK!!!!!!!! Here the usefull things from the main class PHP: public $particle = 0;public function onJoin(PlayerJoinEvent $event){$level = $this->getServer()->getLevelByName("world");$level->addParticle(new FloatingTextParticle(new Vector3(910, 11, 962),"", "§aPlatziere eine Kiste auf\n §adem §6Diamantblock"));}
It should be PHP: $part = new FloatingTextParticle(new Vector3(910, 11, 962), "§aPlatziere eine Kiste auf\n §adem §6Diamantblock");
No. You must call setInvisible() on the same instance of FloatingTextParticle. Every time you construct a new FloatingTextParticle, the new particle will hold a new entity ID. You must use the same old FloatingTextParticle to despawn it. In simple words, you should have a class property that stores the FloatingTextParticle you created, before you first add that particle to the world. Then when you despawn it, you have to retrieve that one particle, and then call setInvisible() on it. Creating another particle is meaningless, even if the new particle has the exactly same parameters, because the particle is identified by its entity ID, not its nametag.