From ec35500c638c43cd211d1b33578256715a2c31cf Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 3 Mar 2012 01:58:40 +0000 Subject: [PATCH] Implemented Villager API for getting/setting Profession. This adds BUKKIT-887 --- .../org/bukkit/craftbukkit/entity/CraftVillager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 2cb26a7b40..7cf5e4b720 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/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()); + } }