From c387d7e66e7a82cf9511cc4d24024c6d265eb4ae Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 20 May 2020 21:49:46 +1200 Subject: [PATCH] Set armorstand ids to int[] to fix gson setting it to null --- .../disguise/disguisetypes/Disguise.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index e697cd6d..ae7d2a24 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -115,6 +115,17 @@ public abstract class Disguise { return multiName.length; } + /** + * Gson why you so dumb and set it to null + */ + private int[] getInternalArmorstandIds() { + if (armorstandIds == null) { + armorstandIds = new int[0]; + } + + return armorstandIds; + } + public String[] getMultiName() { return DisguiseUtilities.reverse(multiName); } @@ -158,7 +169,7 @@ public abstract class Disguise { } public int[] getArmorstandIds() { - if (getMultiNameLength() > armorstandIds.length) { + if (getMultiNameLength() > getInternalArmorstandIds().length) { int oldLen = armorstandIds.length; armorstandIds = Arrays.copyOf(armorstandIds, getMultiNameLength()); @@ -912,9 +923,9 @@ public abstract class Disguise { } } - if (armorstandIds.length > 0) { + if (getInternalArmorstandIds().length > 0) { PacketContainer packet = new PacketContainer(Server.ENTITY_DESTROY); - packet.getIntegerArrays().write(0, armorstandIds); + packet.getIntegerArrays().write(0, getInternalArmorstandIds()); try { for (Player player : getEntity().getWorld().getPlayers()) {