@@ -0,0 +1,907 @@
+package info.u_team.u_team_core.util;%0A%0Aimport java.io.*;%0Aimport java.nio.file.*;%0Aimport java.util.function.Function;%0A%0Aimport com.google.gson.Gson;%0Aimport com.google.gson.stream.JsonWriter;%0A%0Apublic class ConfigUtil %7B%0A%09%0A%09public static %3CT%3E T loadConfig(Path directory, String name, Gson gson, Function%3CJsonWriter, T%3E write, Function%3CBufferedReader, T%3E read) throws IOException %7B%0A%09%09final Path path = directory.resolve(name + %22.json%22);%0A%09%09if (Files.exists(path) && Files.isReadable(path) && Files.isReadable(path)) %7B%0A%09%09%09try (BufferedReader reader = Files.newBufferedReader(path)) %7B%0A%09%09%09%09return read.apply(reader);%0A%09%09%09%7D%0A%09%09%7D else %7B%0A%09%09%09Files.deleteIfExists(path);%0A%09%09%09Files.createDirectories(directory);%0A%09%09%09Files.createFile(path);%0A%09%09%09try (BufferedWriter bufferedWriter = Files.newBufferedWriter(path); JsonWriter writer = GsonUtil.createTabWriter(gson, bufferedWriter)) %7B%0A%09%09%09%09return write.apply(writer);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add config util to load json files and create default ones