Add canUpdate Method

This commit is contained in:
RayzsYT committed 2024-06-30 02:09:45 +02:00
1 parent 2b68328fe1
commit 4323602375
1 file changed
+7
@@ -9,11 +9,14 @@ import java.io.*;
public class ConfigUpdater {
private static List<String> NEWEST_CONFIG_INPUT = new ArrayList<>();
private static boolean LOADED = false;
public static void initialize() {
NEWEST_CONFIG_INPUT = new ConnectionBuilder().setUrl("https://raw.githubusercontent.com/RayzsYT/ProAntiTab/main/src/main/resources/files/"
+ (Reflection.isProxyServer() ? " proxy" : "bukkit")
+ "-config.yml").connect().getResponseList();
LOADED = !NEWEST_CONFIG_INPUT.isEmpty();
}
public static void updateConfigFile(File file, String target, boolean section) {
@@ -53,6 +56,10 @@ public class ConfigUpdater {
return target;
}
public static boolean canUpdate() {
return LOADED;
}
public static int[] getSectionPositionByTarget(List<String> lines, String targetPath, boolean comments) {
HashMap<Integer, String> hash = new HashMap<>();
int sections = 0;