Set armorstand ids to int[] to fix gson setting it to null
This commit is contained in:
parent
341ba27649
commit
c387d7e66e
@ -115,6 +115,17 @@ public abstract class Disguise {
|
|||||||
return multiName.length;
|
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() {
|
public String[] getMultiName() {
|
||||||
return DisguiseUtilities.reverse(multiName);
|
return DisguiseUtilities.reverse(multiName);
|
||||||
}
|
}
|
||||||
@ -158,7 +169,7 @@ public abstract class Disguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int[] getArmorstandIds() {
|
public int[] getArmorstandIds() {
|
||||||
if (getMultiNameLength() > armorstandIds.length) {
|
if (getMultiNameLength() > getInternalArmorstandIds().length) {
|
||||||
int oldLen = armorstandIds.length;
|
int oldLen = armorstandIds.length;
|
||||||
|
|
||||||
armorstandIds = Arrays.copyOf(armorstandIds, getMultiNameLength());
|
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);
|
PacketContainer packet = new PacketContainer(Server.ENTITY_DESTROY);
|
||||||
packet.getIntegerArrays().write(0, armorstandIds);
|
packet.getIntegerArrays().write(0, getInternalArmorstandIds());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (Player player : getEntity().getWorld().getPlayers()) {
|
for (Player player : getEntity().getWorld().getPlayers()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user