aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/utils/Utils.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2021-07-05 20:25:16 -0400
committerbowser0000 <bowser0000@gmail.com>2021-07-05 20:25:16 -0400
commitf8af37d28a9fce4e3b5483bed0a2677d010bf37b (patch)
tree84050c9fbaf615fd98921084fe05e1dad251e349 /src/main/java/me/Danker/utils/Utils.java
parenta44dc53ce80e9914595d5b646dc5623ddd3450b1 (diff)
downloadSkyblockMod-f8af37d28a9fce4e3b5483bed0a2677d010bf37b.tar.gz
SkyblockMod-f8af37d28a9fce4e3b5483bed0a2677d010bf37b.tar.bz2
SkyblockMod-f8af37d28a9fce4e3b5483bed0a2677d010bf37b.zip
Auto reload repo every 1 hour
Diffstat (limited to 'src/main/java/me/Danker/utils/Utils.java')
-rw-r--r--src/main/java/me/Danker/utils/Utils.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
index e2dde4b..e1a99ea 100644
--- a/src/main/java/me/Danker/utils/Utils.java
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -1,7 +1,9 @@
package me.Danker.utils;
import me.Danker.DankersSkyblockMod;
+import me.Danker.features.ColouredNames;
import me.Danker.features.GoldenEnchants;
+import me.Danker.handlers.APIHandler;
import me.Danker.handlers.ConfigHandler;
import me.Danker.handlers.ScoreboardHandler;
import me.Danker.handlers.TextRenderer;
@@ -30,6 +32,7 @@ import java.util.List;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
public class Utils {
@@ -614,4 +617,13 @@ public class Utils {
return level;
}
+ public static void refreshRepo() {
+ DankersSkyblockMod.data = APIHandler.getResponse("https://raw.githubusercontent.com/bowser0000/SkyblockMod-REPO/main/data.json");
+ System.out.println("Loaded data from GitHub?: " + (DankersSkyblockMod.data != null && DankersSkyblockMod.data.has("trivia")));
+ ColouredNames.users = DankersSkyblockMod.data.get("colourednames").getAsJsonObject().entrySet().stream()
+ .map(Map.Entry::getKey)
+ .collect(Collectors.toCollection(ArrayList::new));
+ System.out.println("Refreshed DSM repo at " + System.currentTimeMillis());
+ }
+
}