Actually fix multi names

This commit is contained in:
libraryaddict 2020-06-22 19:39:02 +12:00
parent 3ebf9cce65
commit 407975f41f
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
2 changed files with 11 additions and 2 deletions

View File

@ -77,7 +77,7 @@ public abstract class Disguise {
@Getter @Getter
private BarStyle bossBarStyle = DisguiseConfig.getBossBarStyle(); private BarStyle bossBarStyle = DisguiseConfig.getBossBarStyle();
@Getter(value = AccessLevel.PRIVATE) @Getter(value = AccessLevel.PRIVATE)
private transient final NamespacedKey bossBar = new NamespacedKey(LibsDisguises.getInstance(), UUID.randomUUID().toString()); private final NamespacedKey bossBar = new NamespacedKey(LibsDisguises.getInstance(), UUID.randomUUID().toString());
private FlagWatcher watcher; private FlagWatcher watcher;
/** /**
* If set, how long before disguise expires * If set, how long before disguise expires
@ -114,7 +114,7 @@ public abstract class Disguise {
} }
public int getMultiNameLength() { public int getMultiNameLength() {
return multiName == null ? 0 : multiName.length; return multiName.length;
} }
@RandomDefaultValue @RandomDefaultValue
@ -1090,6 +1090,11 @@ public abstract class Disguise {
throw new IllegalStateException("No entity is assigned to this disguise!"); throw new IllegalStateException("No entity is assigned to this disguise!");
} }
// Fix for old LD updates to new LD where gson hates missing fields
if (multiName == null) {
multiName = new String[0];
}
if (LibsPremium.getUserID().equals("123" + "45") || !LibsMsg.OWNED_BY.getRaw().contains("'")) { if (LibsPremium.getUserID().equals("123" + "45") || !LibsMsg.OWNED_BY.getRaw().contains("'")) {
((TargetedDisguise) this).setDisguiseTarget(TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS); ((TargetedDisguise) this).setDisguiseTarget(TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS);

View File

@ -1788,6 +1788,10 @@ public class DisguiseUtilities {
} }
public static String[] reverse(String[] array) { public static String[] reverse(String[] array) {
if (array == null) {
return new String[0];
}
String[] newArray = new String[array.length]; String[] newArray = new String[array.length];
for (int i = 1; i <= array.length; i++) { for (int i = 1; i <= array.length; i++) {