Doesnt Vanish or send popup! PHP: <?phpnamespace DR\ClockReveal;use pocketmine\event\player\PlayerInteractEvent;use pocketmine\plugin\PluginBase;use pocketmine\Player;use pocketmine\event\Listener;use pocketmine\Server;use pocketmine\item\Item;class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("ClockReveal enabled! Developed by SM11");} public function onDisable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info("ClockReveal enabled! Developed by SM11");}public function onPlayerInteract(PlayerInteractEvent $event) { $item = $event->getItem(); if ($item->getId() === Item::CLOCK && ($event->getAction() === PlayerInteractEvent::RIGHT_CLICK_AIR || $event->getAction() === PlayerInteractEvent::RIGHT_CLICK_BLOCK)) { // If player is holding a stick AND they have just right clicked $message = "§b§l§oTap to unvanish!"; $player->sendPopup($message); $player = $event->getPlayer(); $p = $event->getPlayer(); foreach($this->getServer()->getOnlinePlayers() as $x){ $x->showPlayer($p); } $this->player = $p; }}}
You are trying to send them the popup, but $player isn't defined at that time, try switching those 2 lines around. From: PHP: $player->sendPopup($message); $player = $event->getPlayer(); To: PHP: $player = $event->getPlayer(); $player->sendPopup($message);
And you don't need to get the player twice (You have $player = $event->getPlayer; and on the next line, $p = $event->getPlayer; )