Minor cleanup of DisguiseUtilities.checkConflicts

This commit is contained in:
libraryaddict 2020-04-20 23:03:54 +12:00
parent 0945fe866c
commit 445d52e277
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4

View File

@ -489,13 +489,20 @@ public class DisguiseUtilities {
*/
public static void checkConflicts(TargetedDisguise disguise, String name) {
// If the disguise is being used.. Else we may accidentally undisguise something else
if (DisguiseAPI.isDisguiseInUse(disguise)) {
if (!DisguiseAPI.isDisguiseInUse(disguise)) {
return;
}
Iterator<TargetedDisguise> disguiseItel = getDisguises().get(disguise.getEntity().getUniqueId()).iterator();
// Iterate through the disguises
while (disguiseItel.hasNext()) {
TargetedDisguise d = disguiseItel.next();
// Make sure the disguise isn't the same thing
if (d != disguise) {
if (d == disguise) {
continue;
}
// If the loop'd disguise is hiding the disguise to everyone in its list
if (d.getDisguiseTarget() == TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS) {
// If player is a observer in the loop
@ -545,8 +552,6 @@ public class DisguiseUtilities {
}
}
}
}
}
/**
* Sends entity removal packets, as this disguise was removed