Untitled
unknown
plain_text
2 years ago
1.1 kB
1
Indexable
Never
<?php namespace FlyingText; use pocketmine\plugin\PluginBase; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\level\particle\FloatingTextParticle; use pocketmine\level\Position; use pocketmine\Player; class FlyingTextPlugin extends PluginBase { public function onEnable(){ $this->getLogger()->info("FlyingTextPlugin is enabled!"); $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool{ if($command->getName() === "flytext" && isset($args[0])) { $this->showFloatingText($sender, $args[0]); return true; } return false; } public function showFloatingText(Player $player, string $text): void { $particle = new FloatingTextParticle(new Position($player->getX(), $player->getY() + 2, $player->getZ(), $player->getLevel()), $text); $player->getLevel()->addParticle($particle, [$player]); } }