mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-25 20:02:23 +00:00
Final updates for JsonBuilder
This commit is contained in:
parent
9a953f88f3
commit
8dd2a12375
@ -21,11 +21,15 @@ public class JsonBuilder {
|
|||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
public Part() {
|
public Part() {
|
||||||
this("");
|
this("", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Part(Object value) {
|
public Part(Object value) {
|
||||||
if (value instanceof CharSequence) {
|
this(value, value instanceof CharSequence);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Part(Object value, boolean appendQuotes) {
|
||||||
|
if (appendQuotes) {
|
||||||
this.value = "\"" + value + "\"";
|
this.value = "\"" + value + "\"";
|
||||||
} else {
|
} else {
|
||||||
this.value = String.valueOf(value);
|
this.value = String.valueOf(value);
|
||||||
@ -220,6 +224,7 @@ public class JsonBuilder {
|
|||||||
Object packetPlayOutChat = packetPlayOutChatClass.getConstructor(iChatBaseComponentClass).newInstance(iChatBaseComponent);
|
Object packetPlayOutChat = packetPlayOutChatClass.getConstructor(iChatBaseComponentClass).newInstance(iChatBaseComponent);
|
||||||
|
|
||||||
Utils.sendPacket(plugin, packetPlayOutChat, p);
|
Utils.sendPacket(plugin, packetPlayOutChat, p);
|
||||||
|
plugin.debug("Sent JSON: " + toString());
|
||||||
} catch (InstantiationException | InvocationTargetException |
|
} catch (InstantiationException | InvocationTargetException |
|
||||||
IllegalAccessException | NoSuchMethodException e) {
|
IllegalAccessException | NoSuchMethodException e) {
|
||||||
plugin.getLogger().severe("Failed to send JSON with reflection");
|
plugin.getLogger().severe("Failed to send JSON with reflection");
|
||||||
|
Loading…
Reference in New Issue
Block a user