From 8dd2a1237522b072570512e33e1179bc89764db1 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 26 Jul 2018 15:48:25 +0200 Subject: [PATCH] Final updates for JsonBuilder --- src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java b/src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java index 377d4c0..ccf822e 100644 --- a/src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java +++ b/src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java @@ -21,11 +21,15 @@ public class JsonBuilder { private String value; public Part() { - this(""); + this("", true); } public Part(Object value) { - if (value instanceof CharSequence) { + this(value, value instanceof CharSequence); + } + + public Part(Object value, boolean appendQuotes) { + if (appendQuotes) { this.value = "\"" + value + "\""; } else { this.value = String.valueOf(value); @@ -220,6 +224,7 @@ public class JsonBuilder { Object packetPlayOutChat = packetPlayOutChatClass.getConstructor(iChatBaseComponentClass).newInstance(iChatBaseComponent); Utils.sendPacket(plugin, packetPlayOutChat, p); + plugin.debug("Sent JSON: " + toString()); } catch (InstantiationException | InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { plugin.getLogger().severe("Failed to send JSON with reflection");