mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Fix compat with older Gson versions (#791)
This commit is contained in:
parent
68dd96e563
commit
b2175e885f
@ -27,6 +27,7 @@ package me.lucko.luckperms.common.utils.gson;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
@ -40,7 +41,7 @@ public class JArray implements JElement {
|
||||
}
|
||||
|
||||
public JArray add(String value) {
|
||||
this.array.add(value);
|
||||
this.array.add(new JsonPrimitive(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ package me.lucko.luckperms.common.utils.gson;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
@ -39,26 +40,23 @@ public class JObject implements JElement {
|
||||
return this.object;
|
||||
}
|
||||
|
||||
public JObject add(String key, String value) {
|
||||
this.object.addProperty(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public JObject add(String key, Number value) {
|
||||
this.object.addProperty(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public JObject add(String key, Boolean value) {
|
||||
this.object.addProperty(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public JObject add(String key, JsonElement value) {
|
||||
this.object.add(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public JObject add(String key, String value) {
|
||||
return add(key, new JsonPrimitive(value));
|
||||
}
|
||||
|
||||
public JObject add(String key, Number value) {
|
||||
return add(key, new JsonPrimitive(value));
|
||||
}
|
||||
|
||||
public JObject add(String key, Boolean value) {
|
||||
return add(key, new JsonPrimitive(value));
|
||||
}
|
||||
|
||||
public JObject add(String key, JElement value) {
|
||||
return add(key, value.toJson());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user