Skip to content

Commit

Permalink
Update PlayerJoinListener.php
Browse files Browse the repository at this point in the history
  • Loading branch information
antbag-dev authored May 15, 2024
1 parent 1b4d792 commit 8d4a5b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/antbag/JoinCount/PlayerJoinListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public function onPlayerJoin(PlayerJoinEvent $event) {
}

private function loadData(): array {
$data = file_get_contents($this->dataFile);
return json_decode($data, true) ?? [];
if (!file_exists($this->dataFile)) {
return [];
}
$data = file_get_contents($this->dataFile);
return json_decode($data, true) ?? [];
}

private function saveData(array $data) {
$encodedData = json_encode($data);
file_put_contents($this->dataFile, $encodedData);
}
}
}

0 comments on commit 8d4a5b6

Please sign in to comment.