aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2020-06-16 02:32:15 +0200
committerCow <cow@volloeko.de>2020-06-16 02:32:15 +0200
commitc2c644d9b0f8a66e757b67145935b0e3c447db97 (patch)
tree627c087f6b8c165e4fb3506ff7b559afd2318ddc /src/main/java/eu/olli/cowmoonication/handler/FriendsHandler.java
parentb9d6b75423ea24c4947b3a655f199c3b34aa167a (diff)
downloadCowlection-c2c644d9b0f8a66e757b67145935b0e3c447db97.tar.gz
Cowlection-c2c644d9b0f8a66e757b67145935b0e3c447db97.tar.bz2
Cowlection-c2c644d9b0f8a66e757b67145935b0e3c447db97.zip
Added `/moo search` to search through mc log files
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) {