diff --git a/src/SimpleAuth/task/ShowMessageTask.php b/src/SimpleAuth/task/ShowMessageTask.php index 7ea52a1..4a1be52 100644 --- a/src/SimpleAuth/task/ShowMessageTask.php +++ b/src/SimpleAuth/task/ShowMessageTask.php @@ -39,11 +39,11 @@ public function getPlugin(){ } public function addPlayer(Player $player){ - $this->playerList[$player->getUniqueId()] = $player; + $this->playerList[spl_object_hash($player->getUniqueId())] = $player; } public function removePlayer(Player $player){ - unset($this->playerList[$player->getUniqueId()]); + $this->playerList[spl_object_hash($player->getUniqueId())] = null; } public function onRun($currentTick){ @@ -53,8 +53,10 @@ public function onRun($currentTick){ } foreach($this->playerList as $player){ + if($player==null){ + continue; + } $player->sendPopup(TextFormat::ITALIC . TextFormat::GRAY . $this->getPlugin()->getMessage("join.popup")); } } - -} \ No newline at end of file +}