From d7010c6389d18aa2407fe062e0106bf5b20fc47f Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 2 Jun 2014 08:56:07 +1200 Subject: [PATCH] Add AnimalColor for Sheep color and wolf color --- src/me/libraryaddict/disguise/DisguiseAPI.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java index da4e3ad9..f81fb5a8 100644 --- a/src/me/libraryaddict/disguise/DisguiseAPI.java +++ b/src/me/libraryaddict/disguise/DisguiseAPI.java @@ -8,6 +8,7 @@ import java.util.Collection; import java.util.List; import java.util.UUID; +import me.libraryaddict.disguise.disguisetypes.AnimalColor; import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import me.libraryaddict.disguise.disguisetypes.FlagWatcher; @@ -24,6 +25,7 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities; import me.libraryaddict.disguise.utilities.ReflectionManager; import org.bukkit.Bukkit; +import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -31,7 +33,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; public class DisguiseAPI { @@ -98,8 +99,8 @@ public class DisguiseAPI { Class methodParam = watcherMethod.getParameterTypes()[0]; if (methodParam == float.class || methodParam == Float.class || methodParam == Double.class) { methodParam = double.class; - } else if (methodParam == PotionEffect.class) { - methodParam = PotionEffectType.class; + } else if (methodParam == AnimalColor.class) { + methodParam = DyeColor.class; } if (methodReturn == methodParam) { try { @@ -121,6 +122,8 @@ public class DisguiseAPI { float d = (Float) value; value = (double) d; } + } else if (toCast == AnimalColor.class) { + value = AnimalColor.valueOf(((DyeColor) value).name()); } } if (value instanceof Boolean && !(Boolean) value