From 5abe32ff6c90feaba64073644cd1cdef451af904 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 3 Mar 2012 01:58:40 +0000 Subject: [PATCH] Implemented Villager API for getting/setting Profession. This adds BUKKIT-887 By: Nathan Adams --- .../org/bukkit/craftbukkit/entity/CraftVillager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 2cb26a7b40..7cf5e4b720 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -1,7 +1,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityVillager; - +import org.apache.commons.lang.Validate; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Villager; @@ -24,4 +24,13 @@ public class CraftVillager extends CraftCreature implements Villager { public EntityType getType() { return EntityType.VILLAGER; } + + public Profession getProfession() { + return Profession.getProfession(getHandle().getProfession()); + } + + public void setProfession(Profession profession) { + Validate.notNull(profession); + getHandle().setProfession(profession.getId()); + } }