Use Collection with no <String> or <Player> so that you can feed either in as a parameter
This commit is contained in:
		| @@ -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<String> 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<String> playersToNotSeeDisguise) { | ||||
|         disguiseIgnorePlayers(entity, disguise, playersToNotSeeDisguise); | ||||
|     } | ||||
|  | ||||
|     public static void disguiseIgnorePlayers(Entity entity, Disguise disguise, Player... playersToNotSeeDisguise) { | ||||
|         ArrayList<String> names = new ArrayList<String>(); | ||||
|         for (Player p : playersToNotSeeDisguise) { | ||||
| @@ -109,17 +119,26 @@ public class DisguiseAPI { | ||||
|         disguiseEntity(entity, disguise); | ||||
|     } | ||||
|  | ||||
|     public static void disguiseToPlayers(Entity entity, Disguise disguise, List<String> 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<String> playersToViewDisguise) { | ||||
|         disguiseToPlayers(entity, disguise, playersToViewDisguise); | ||||
|     } | ||||
|  | ||||
|     public static void disguiseToPlayers(Entity entity, Disguise disguise, Player... playersToViewDisguise) { | ||||
|         ArrayList<String> names = new ArrayList<String>(); | ||||
|         for (Player p : playersToViewDisguise) { | ||||
|   | ||||
| @@ -15,7 +15,6 @@ public abstract class TargetedDisguise extends Disguise { | ||||
|     } | ||||
|  | ||||
|     private List<String> disguiseViewers = new ArrayList<String>(); | ||||
|  | ||||
|     private TargetType targetType = TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS; | ||||
|  | ||||
|     public void addPlayer(Player player) { | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user