Fix zombie villager watcher

This commit is contained in:
libraryaddict 2017-12-14 01:53:48 +13:00
parent cc06600a0b
commit ed52576277

View File

@ -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 {
@ -35,7 +34,12 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
* @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;
}
/**
@ -45,7 +49,7 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
*/
@Deprecated
public void setProfession(int id) {
setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, id);
setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, id % 2);
sendData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION);
}
@ -55,8 +59,6 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
* @param profession
*/
public void setProfession(Profession profession) {
setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, profession.ordinal());
sendData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION);
setProfession(profession.ordinal());
}
}