From 6dad2c03cff6a51543924e434c6889d0c6fb41ae Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 4 Jan 2014 22:16:03 +1300 Subject: [PATCH] Clone the disguise else targeted disguise throws errors --- src/me/libraryaddict/disguise/DisguiseAPI.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java index 56d7c1d4..67fdcbf2 100644 --- a/src/me/libraryaddict/disguise/DisguiseAPI.java +++ b/src/me/libraryaddict/disguise/DisguiseAPI.java @@ -65,6 +65,9 @@ public class DisguiseAPI { } public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, List playersToNotSeeDisguise) { + if (disguise.getEntity() != null) { + disguise = disguise.clone(); + } ((TargetedDisguise) disguise).setDisguiseTarget(TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS); for (String name : playersToNotSeeDisguise) { ((TargetedDisguise) disguise).addPlayer(name); @@ -99,6 +102,9 @@ public class DisguiseAPI { * Disguise this entity with this disguise */ public static void disguiseToAll(Entity entity, Disguise disguise) { + if (disguise.getEntity() != null) { + disguise = disguise.clone(); + } // You called the disguiseToAll method foolish mortal! Prepare to have your custom settings wiped!!! ((TargetedDisguise) disguise).setDisguiseTarget(TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS); for (String observer : ((TargetedDisguise) disguise).getObservers()) @@ -107,6 +113,9 @@ public class DisguiseAPI { } public static void disguiseToPlayers(Entity entity, Disguise disguise, List playersToViewDisguise) { + if (disguise.getEntity() != null) { + disguise = disguise.clone(); + } ((TargetedDisguise) disguise).setDisguiseTarget(TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS); for (String name : playersToViewDisguise) { ((TargetedDisguise) disguise).addPlayer(name);