aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-27 11:53:57 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-27 11:53:57 -0500
commitb09f774d422263ce15b97d6d0804beddf856176d (patch)
treee542258481d7496b15679f3c329ef9e087c7d8fc /src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
parent22cb02adbeb24b7ec98f843bcaba99cebe3e4f03 (diff)
downloadnotenoughupdates-b09f774d422263ce15b97d6d0804beddf856176d.tar.gz
notenoughupdates-b09f774d422263ce15b97d6d0804beddf856176d.tar.bz2
notenoughupdates-b09f774d422263ce15b97d6d0804beddf856176d.zip
feat: improve formating :)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java106
1 files changed, 56 insertions, 50 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
index c49608c6..bb3b3425 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
@@ -8,54 +8,60 @@ import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Pattern;
public class Constants {
- private static class PatternSerializer implements JsonDeserializer<Pattern>, JsonSerializer<Pattern> {
- @Override
- public Pattern deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
- return Pattern.compile(json.getAsString());
- }
-
- @Override
- public JsonElement serialize(Pattern src, Type typeOfSrc, JsonSerializationContext context) {
- return new JsonPrimitive(src.pattern());
- }
- }
-
- private static final Gson gson = new GsonBuilder().setPrettyPrinting()
- .registerTypeAdapter(Pattern.class, new PatternSerializer()).create();
-
- public static JsonObject BONUSES;
- public static JsonObject DISABLE;
- public static JsonObject ENCHANTS;
- public static JsonObject LEVELING;
- public static JsonObject MISC;
- public static JsonObject PETNUMS;
- public static JsonObject PETS;
- public static JsonObject PARENTS;
- public static JsonObject ESSENCECOSTS;
- public static JsonObject FAIRYSOULS;
- public static JsonObject REFORGESTONES;
- public static CollectionConstant COLLECTIONLOG;
-
- private static final ReentrantLock lock = new ReentrantLock();
-
- public static void reload() {
- try {
- lock.lock();
-
- BONUSES = Utils.getConstant("bonuses", gson);
- DISABLE = Utils.getConstant("disable", gson);
- ENCHANTS = Utils.getConstant("enchants", gson);
- LEVELING = Utils.getConstant("leveling", gson);
- MISC = Utils.getConstant("misc", gson);
- PETNUMS = Utils.getConstant("petnums", gson);
- PETS = Utils.getConstant("pets", gson);
- PARENTS = Utils.getConstant("parents", gson);
- ESSENCECOSTS = Utils.getConstant("essencecosts", gson);
- FAIRYSOULS = Utils.getConstant("fairy_souls", gson);
- REFORGESTONES = Utils.getConstant("reforgestones", gson);
- //COLLECTIONLOG = Utils.getConstant("collectionlog", gson, CollectionConstant.class);
- } finally {
- lock.unlock();
- }
- }
+ private static class PatternSerializer implements JsonDeserializer<Pattern>, JsonSerializer<Pattern> {
+ @Override
+ public Pattern deserialize(
+ JsonElement json,
+ Type typeOfT,
+ JsonDeserializationContext context
+ ) throws JsonParseException {
+ return Pattern.compile(json.getAsString());
+ }
+
+ @Override
+ public JsonElement serialize(Pattern src, Type typeOfSrc, JsonSerializationContext context) {
+ return new JsonPrimitive(src.pattern());
+ }
+ }
+
+ private static final Gson gson = new GsonBuilder()
+ .setPrettyPrinting()
+ .registerTypeAdapter(Pattern.class, new PatternSerializer())
+ .create();
+
+ public static JsonObject BONUSES;
+ public static JsonObject DISABLE;
+ public static JsonObject ENCHANTS;
+ public static JsonObject LEVELING;
+ public static JsonObject MISC;
+ public static JsonObject PETNUMS;
+ public static JsonObject PETS;
+ public static JsonObject PARENTS;
+ public static JsonObject ESSENCECOSTS;
+ public static JsonObject FAIRYSOULS;
+ public static JsonObject REFORGESTONES;
+ public static CollectionConstant COLLECTIONLOG;
+
+ private static final ReentrantLock lock = new ReentrantLock();
+
+ public static void reload() {
+ try {
+ lock.lock();
+
+ BONUSES = Utils.getConstant("bonuses", gson);
+ DISABLE = Utils.getConstant("disable", gson);
+ ENCHANTS = Utils.getConstant("enchants", gson);
+ LEVELING = Utils.getConstant("leveling", gson);
+ MISC = Utils.getConstant("misc", gson);
+ PETNUMS = Utils.getConstant("petnums", gson);
+ PETS = Utils.getConstant("pets", gson);
+ PARENTS = Utils.getConstant("parents", gson);
+ ESSENCECOSTS = Utils.getConstant("essencecosts", gson);
+ FAIRYSOULS = Utils.getConstant("fairy_souls", gson);
+ REFORGESTONES = Utils.getConstant("reforgestones", gson);
+ //COLLECTIONLOG = Utils.getConstant("collectionlog", gson, CollectionConstant.class);
+ } finally {
+ lock.unlock();
+ }
+ }
}