diff --git a/common/src/main/java/me/lucko/luckperms/common/utils/gson/JArray.java b/common/src/main/java/me/lucko/luckperms/common/utils/gson/JArray.java index 663298a10..07bc59539 100644 --- a/common/src/main/java/me/lucko/luckperms/common/utils/gson/JArray.java +++ b/common/src/main/java/me/lucko/luckperms/common/utils/gson/JArray.java @@ -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; } diff --git a/common/src/main/java/me/lucko/luckperms/common/utils/gson/JObject.java b/common/src/main/java/me/lucko/luckperms/common/utils/gson/JObject.java index 61977dbaf..e18823261 100644 --- a/common/src/main/java/me/lucko/luckperms/common/utils/gson/JObject.java +++ b/common/src/main/java/me/lucko/luckperms/common/utils/gson/JObject.java @@ -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()); }