how to add an online player, name, but does not appear to appear in floating text This my task : PHP: <?phpnamespace moch;use onebone\economyapi\EconomyAPI;use pocketmine\level\particle\FloatingTextParticle;use pocketmine\math\Vector3;use pocketmine\Player;use pocketmine\scheduler\Task;use moch\Main;class statsTask extends Task { private $plugin; public function __construct(Main $plugin) { $this->plugin = $plugin; } public function onRun(int $currentTick) { $online = count($this->plugin->getServer()->getOnlinePlayers()); $title = "§fWelcome To Test Server"; $message = "§bOnline Players: §c{$online}\n"; $message = "§bServer Version : ALPHA 1.2.0\n"; if(isset($this->pVar)){ //Will probably throw an error else $level = $this->plugin->getServer()->getLevelByName("Test"); //Put level name here $this->pVar->setInvisible(); $level->addParticle($this->pVar, $level->getPlayers()); } $p = new FloatingTextParticle(new Vector3(268, 66, 268), $message, $title); $level = $this->plugin->getServer()->getLevelByName("Test"); //Put level name here $level->addParticle($p, $level->getPlayers()); }}
try this (warning not tested code) PHP: <?phpnamespace moch;use onebone\economyapi\EconomyAPI;use pocketmine\level\particle\FloatingTextParticle;use pocketmine\math\Vector3;use pocketmine\Player;use pocketmine\scheduler\Task;use moch\Main;class statsTask extends Task { private $plugin; public function __construct(Main $plugin) { $this->plugin = $plugin; } public function onRun(int $currentTick) { $online = count($this->plugin->getServer()->getOnlinePlayers()); $title = "§fWelcome To Test Server"; $message = "§bOnline Players: §c{$online}\n"; $message .= "§bServer Version : ALPHA 1.2.0\n"; if(isset($this->pVar)){ //Will probably throw an error else $level = $this->plugin->getServer()->getLevelByName("Test"); //Put level name here $this->pVar->setInvisible(); $level->addParticle($this->pVar, $level->getPlayers()); } $p = new FloatingTextParticle(new Vector3(268, 66, 268), $message, $title); $level = $this->plugin->getServer()->getLevelByName("Test"); //Put level name here $level->addParticle($p, $level->getPlayers()); }}