PHP: <?phpnamespace Core\Tasks\FloatingTexts;class IceArena extends \pocketmine\scheduler\PluginTask {public $ftp = [];public function __construct(\Core\Loader $loader, \pocketmine\Player $player) {parent::__construct($loader);$this->loader = $loader;$this->player = $player;}public function onRun($tick) {$key = $this->player->getLowerCaseName();if(isset($this->ftp[$key])){$this->player->sendMessage("If called!");$this->loader->removeAllTexts($this->player);unset($this->ftp[$key]);} else {$this->player->sendMessage("Else called!");$this->ftp[] = $key;$this->loader->addText($this->player, "Ice");}}} Issue: Else always gets called! If never gets called when it's supposed to be a loop! Possibly an error with the Arrays. :#
Because you are confused about keys and values. If you want to store data by keys: PHP: $this->ftp[$key] = true; // any non-null value is ok, but true makes sure things work correctlyisset($this->ftp[$key]) // check if key $key existsunset($this->ftp[$key]); If you store by values, and keys do not matter: PHP: $this->ftp[] = $key; // the key will be automatically generatedin_array($key, $this->ftp) // check if value $key exists As for unset, it is less convenient: https://stackoverflow.com/a/7225113/3990767 I recommend using the first method. For your reference, the Config class (with type ENUM) also uses the first method