From 7e18b96186b0923e5f6b5b2b93b2d4022072c5d0 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 4 Dec 2017 02:24:19 +1300 Subject: [PATCH] Fix Bukkit's mistake with villager professions --- .../disguise/disguisetypes/watchers/VillagerWatcher.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.java index c0973a52..ea6717f1 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/VillagerWatcher.java @@ -1,10 +1,9 @@ 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 me.libraryaddict.disguise.utilities.DisguiseUtilities; +import org.bukkit.entity.Villager.Profession; public class VillagerWatcher extends AgeableWatcher { @@ -19,7 +18,7 @@ public class VillagerWatcher extends AgeableWatcher { @Deprecated public void setProfession(int professionId) { - setData(MetaIndex.VILLAGER_PROFESSION, professionId); + setData(MetaIndex.VILLAGER_PROFESSION, Math.max(1, Math.min(professionId, Profession.BUTCHER.ordinal()) - 1)); sendData(MetaIndex.VILLAGER_PROFESSION); }