Snippet onEnable PHP: public $hud = []; $this->getServer()->getScheduler()->scheduleRepeatingTask(new Task($this), 20); onCommand PHP: case "hud": $name = strtolower($sender->getName()); if (isset($this->hud[$name])){ $sender->sendMessage("Disabling HUD"); unset($this->hud[$name]); return false; } else{ $sender->sendMessage("Enabling HUD"); $this->hud[$name] = $name; return false; } break; PluginTask onRun PHP: $pl = $this->plugin->getServer()->getOnlinePlayers();foreach($pl as $p){ $name = strtolower($p->getName());if(isset($this->hud[$name])){ $p->sendPopup("\n[Money: §f".$this->plugin->getServer()->getPluginManager()->getPlugin("EconomyAPI")->myMoney($p)."$"."§6]"); }} No errors in console but when i turn on hud it doesn't come up!
You're checking if the array hud from the task, has a value that's been put in the hud array from the main class. That won't work. In your task, you should have: PHP: if(isset($this->getOwner()->hud[$name])) { $p->sendPopup("PopupText");}