Ok in the end of my task i have this function run Spoiler: Code PHP: public function removePlayer(string $p) { $all = $this->getXpmine()->getAll(); if ($p instanceof Player){ //Here $p = $this->getServer()->getPlayer($p); if (isset($all[$p->getName()])) unset($all[$p->getName()]); $this->getXpmine()->setAll($all); $this->getXpmine()->save(); //To here }else{ $queue = $this->getQueued()->getAll(); if (!isset($queue[$p])){ $queue[$p] = 1; $this->getQueued()->setAll($queue); $this->getQueued()->save(); if (isset($all[$p])) unset($all[$p]); $this->getXpmine()->setAll($all); $this->getXpmine()->save(); } } } When the player is offline it runs correctly When the player is online it only runs the offline part the online isnt even getting called. So what did i mess up?
Code: $all = $this->getXpmine()->getAll(); $p = $this->getServer()->getPlayer($p); if ($p instanceof Player){ //Here if (isset($all[$p->getName()])) unset($all[$p->getName()]);