I brought up a floating text with an order I created, but now I have no idea how I could delete it. PHP: <?phpnamespace DevAkya\Commands\Staff\Admin;use DevAkya\Main;use pocketmine\level\particle\FloatingTextParticle;use pocketmine\math\Vector3;use pocketmine\level\Position;use pocketmine\command\CommandSender;use pocketmine\command\PluginCommand;use pocketmine\Player;use jojoe77777\FormAPI;use jojoe77777\FormAPI\SimpleForm;class FloatText extends PluginCommand { /** @var Main $plugin */ private $plugin; const PREFIX = "§l§f[§l§4PRIVATE§f]§r "; const ADD = "§3Cliquer pour ajouter"; public function __construct(Main $plugin) { parent::__construct("ft", $plugin); $this->setDescription("§4Floating Text"); $this->setPermission("perm.admin"); $this->plugin = $plugin; } public function execute(CommandSender $sender, string $commandLabel, array $args) { if($sender instanceof Player) { if($sender->hasPermission("perm.admin")) { $api = $this->plugin->getServer()->getPluginManager()->getPlugin("FormAPI"); if($api === null || $api->isDisabled()) { return true; } $form = $api->createSimpleForm(function(Player $sender, $data) { $result = $data; if($result === null) { return; } switch($result) { case 0: // Entity 1 $n = $sender->getPlayer(); $name = $n->getName(); $money = "§61500ec"; $online = $this->plugin->getServer()->getOnlinePlayers(); $x = $sender->x; $y = $sender->y; $z = $sender->z; $title = "§7-=-=-=- §l§9Extoria§fNetwork§r §7-=-=-="; $text = "test"; $fentityone = new FloatingTextParticle(new Vector3($x,$y,$z), $text, $title); $sender->getLevel()->addParticle($fentityone); break; } }); $form->setTitle(self::PREFIX); $form->setContent(self::PREFIX . "§cMerci de n'utiliser cette UI seulement si vous êtes l'utilisateur \n \n§7- §aAkyaSurMc \n \n "); $form->addButton("§2Entity 1 \n " . self::ADD); $form->sendToPlayer($sender); } else { $sender->sendMessage("§cError ..."); } } else { $this->plugin->getLogger()->info("Vous ne pouvez pas utiliser cette commande dans la console."); } }}
I don't think it is possible to delete particle. It's better to make floating texts using entities. Here is my api which allows to remove texts too.
PHP: // Spawning text$textId = FloatingTextApi::createText($vector3); // $vector3 -> position of floating text, This function is just for initializeFloatingTextApi::sendText($textId, $player, "YourTextHere\nSecondLine"); // This you can use to spawn text, and for update too// Removing textFloatingTextApi::removeText($textId, $player); // It removes text just for the specified player..