PHP: <?phpnamespace Core;use pocketmine\scheduler\PluginTask;use pocketmine\level\particle\FloatingTextParticle;use pocketmine\math\Vector3;class ParticleTask2 extends PluginTask{ public function __construct(Core $plugin) { $this->plugin = $plugin; parent::__construct($plugin); } public function onRun($currentTick) { $text = new FloatingTextParticle(new Vector3(140, 6, 140), "§eSWAG"); $text->setInvisible(true); $level = $this->plugin->getServer()->getLevelByName("Lobby-1"); $level->addParticle($text); }} Dont work :/ It remove particle and dont add
What are you trying to do? Your code just sets the new particle to be invisible and add it, which despawns it from the player, so the particle is never spawned to the player
I add to text how many players is online and by replacing floating text updaten count of online players !
Then you can just do smth like this PHP: public function __construct(Core $plugin) { $this->plugin = $plugin; parent::__construct($plugin);$this->text = new FloatingTextParticle(new Vector3(140, 6, 140),"", "§eSWAG"); } public function onRun($currentTick) { $this->text->setText("Online: ".count($this->plugin->getServer()->getOnlinePlayers())); $level = $this->plugin->getServer()->getLevelByName("Lobby-1"); if($level) $level->addParticle($this->text); }
Thx i used this Spoiler <?php namespace Core; use pocketmine\math\Vector3; use pocketmine\level\particle\FloatingTextParticle; use pocketmine\scheduler\PluginTask; class ParticleTask extends PluginTask { public function __construct(Core $plugin) { $this->plugin = $plugin; parent::__construct($plugin); $this->text = new FloatingTextParticle(new Vector3(140, 6, 140), "", "§e"); } public function onRun($currentTick) { $this->text->setText("Online: " . count($this->plugin->getServer()->getOnlinePlayers())); $level = $this->plugin->getServer()->getLevelByName("Lobby-1"); if ($level) $level->addParticle($this->text); } }