mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 01:25:03 +01:00
Implemented Villager API for getting/setting Profession. This adds BUKKIT-887
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
2a44aa7a2a
commit
5abe32ff6c
1 changed files with 10 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
import net.minecraft.server.EntityVillager;
|
import net.minecraft.server.EntityVillager;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
|
@ -24,4 +24,13 @@ public class CraftVillager extends CraftCreature implements Villager {
|
||||||
public EntityType getType() {
|
public EntityType getType() {
|
||||||
return EntityType.VILLAGER;
|
return EntityType.VILLAGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Profession getProfession() {
|
||||||
|
return Profession.getProfession(getHandle().getProfession());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfession(Profession profession) {
|
||||||
|
Validate.notNull(profession);
|
||||||
|
getHandle().setProfession(profession.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue