Some minor improvements to ConfigHelper

This commit is contained in:
Cheeserolls 2015-05-24 14:51:48 +01:00
parent 957f1de812
commit 17ea1755e8

View file

@ -36,7 +36,7 @@ public class ConfigHelper
public static Gson serializer = new GsonBuilder().setPrettyPrinting().create(); public static Gson serializer = new GsonBuilder().setPrettyPrinting().create();
public static JsonParser parser = new JsonParser(); public static JsonParser parser = new JsonParser();
public JsonBlockState blockStateParser = new JsonBlockState(); public JsonBlockState blockStateParser = new JsonBlockState();
public WrappedJsonObject root; public WrappedJsonObject root = null;
public ArrayList<String> messages = new ArrayList<String>(); public ArrayList<String> messages = new ArrayList<String>();
@ -60,6 +60,11 @@ public class ConfigHelper
this.parse(jsonString); this.parse(jsonString);
} }
public boolean isNull()
{
return this.root == null;
}
public void parse(String jsonString) public void parse(String jsonString)
{ {
this.root = null; this.root = null;
@ -157,13 +162,13 @@ public class ConfigHelper
private static enum Types {BOOLEAN, STRING, INTEGER, FLOAT, BLOCKSTATE} private static enum Types {BOOLEAN, STRING, INTEGER, FLOAT, BLOCKSTATE}
private class WrappedJsonObject public class WrappedJsonObject
{ {
private JsonObject obj;
private ConfigHelper conf;
protected JsonObject obj; public WrappedJsonObject(ConfigHelper conf, JsonObject obj)
protected ConfigHelper conf;
WrappedJsonObject(ConfigHelper conf, JsonObject obj)
{ {
this.obj = obj; this.obj = obj;
this.conf = conf; this.conf = conf;
@ -379,4 +384,6 @@ public class ConfigHelper
} }
} }
} }