aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java')
-rw-r--r--src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java b/src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java
index 9ec469e..8d714a1 100644
--- a/src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java
+++ b/src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java
@@ -148,9 +148,13 @@ public class FriendsHandler {
private void loadBestFriends() {
try {
+ boolean createdNewFile = this.bestFriendsFile.createNewFile();
+
this.bestFriends.clear();
- String bestFriendsData = FileUtils.readFileToString(this.bestFriendsFile, StandardCharsets.UTF_8);
- this.bestFriends.addAll(parseJson(bestFriendsData));
+ if (!createdNewFile) {
+ String bestFriendsData = FileUtils.readFileToString(this.bestFriendsFile, StandardCharsets.UTF_8);
+ this.bestFriends.addAll(parseJson(bestFriendsData));
+ }
} catch (IOException e) {
main.getLogger().error("Couldn't read best friends file " + this.bestFriendsFile, e);
} catch (JsonParseException e) {