From ed525762774bbc7c0e52d07bc020de0bd0bd20ad Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 14 Dec 2017 01:53:48 +1300 Subject: [PATCH] Fix zombie villager watcher --- .../watchers/ZombieVillagerWatcher.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/ZombieVillagerWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/ZombieVillagerWatcher.java index 49c1a1eb..6dfea7b2 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/ZombieVillagerWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/ZombieVillagerWatcher.java @@ -1,9 +1,8 @@ package me.libraryaddict.disguise.disguisetypes.watchers; -import org.bukkit.entity.Villager.Profession; - import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.MetaIndex; +import org.bukkit.entity.Villager.Profession; public class ZombieVillagerWatcher extends ZombieWatcher { @@ -17,7 +16,7 @@ public class ZombieVillagerWatcher extends ZombieWatcher { /** * Is this zombie a villager? - * + * * @return */ public boolean isVillager() { @@ -31,32 +30,35 @@ public class ZombieVillagerWatcher extends ZombieWatcher { /** * Only returns a valid value if this zombie is a villager. - * + * * @return */ public Profession getProfession() { - return Profession.values()[getData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION)]; + int ord = getData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION); + + if (ord == 1) + return Profession.HUSK; + + return Profession.NORMAL; } /** * Sets the profession of this zombie, in turn turning it into a Zombie Villager - * + * * @param id */ @Deprecated public void setProfession(int id) { - setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, id); + setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, id % 2); sendData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION); } /** * Sets the profession of this zombie, in turn turning it into a Zombie Villager - * + * * @param profession */ public void setProfession(Profession profession) { - setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, profession.ordinal()); - sendData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION); + setProfession(profession.ordinal()); } - }