diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java index d61cbc6a..6703d986 100644 --- a/src/me/libraryaddict/disguise/DisguiseAPI.java +++ b/src/me/libraryaddict/disguise/DisguiseAPI.java @@ -3,6 +3,7 @@ package me.libraryaddict.disguise; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.UUID; @@ -51,17 +52,26 @@ public class DisguiseAPI { DisguiseUtilities.setupFakeDisguise(disguise); } - public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, List playersToNotSeeDisguise) { + public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, Collection 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); + for (Object obj : playersToNotSeeDisguise) { + if (obj instanceof String) { + ((TargetedDisguise) disguise).addPlayer((String) obj); + } else if (obj instanceof Player) { + ((TargetedDisguise) disguise).addPlayer(((Player) obj).getName()); + } } disguiseEntity(entity, disguise); } + @Deprecated + public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, List playersToNotSeeDisguise) { + disguiseIgnorePlayers(entity, disguise, playersToNotSeeDisguise); + } + public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, Player... playersToNotSeeDisguise) { ArrayList names = new ArrayList(); for (Player p : playersToNotSeeDisguise) { @@ -109,17 +119,26 @@ public class DisguiseAPI { disguiseEntity(entity, disguise); } - public static void disguiseToPlayers(Entity entity, Disguise disguise, List playersToViewDisguise) { + public static void disguiseToPlayers(Entity entity, Disguise disguise, Collection 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); + for (Object obj : playersToViewDisguise) { + if (obj instanceof String) { + ((TargetedDisguise) disguise).addPlayer((String) obj); + } else if (obj instanceof Player) { + ((TargetedDisguise) disguise).addPlayer(((Player) obj).getName()); + } } disguiseEntity(entity, disguise); } + @Deprecated + public static void disguiseToPlayers(Entity entity, Disguise disguise, List playersToViewDisguise) { + disguiseToPlayers(entity, disguise, playersToViewDisguise); + } + public static void disguiseToPlayers(Entity entity, Disguise disguise, Player... playersToViewDisguise) { ArrayList names = new ArrayList(); for (Player p : playersToViewDisguise) { diff --git a/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java index bb912ff7..dfc9fe79 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java @@ -15,7 +15,6 @@ public abstract class TargetedDisguise extends Disguise { } private List disguiseViewers = new ArrayList(); - private TargetType targetType = TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS; public void addPlayer(Player player) { diff --git a/src/me/libraryaddict/disguise/utilities/ClassGetter.java b/src/me/libraryaddict/disguise/utilities/ClassGetter.java index cc932613..3990089c 100644 --- a/src/me/libraryaddict/disguise/utilities/ClassGetter.java +++ b/src/me/libraryaddict/disguise/utilities/ClassGetter.java @@ -2,7 +2,6 @@ package me.libraryaddict.disguise.utilities; import org.bukkit.entity.Entity; -import java.io.IOException; import java.net.URL; import java.net.URLDecoder; import java.security.CodeSource;