Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
Villager.java
Go to the documentation of this file.
1 package org.bukkit.entity;
2 
6 public interface Villager extends Ageable, NPC {
12  public Profession getProfession();
13 
19  public void setProfession(Profession profession);
20 
21 
25  public enum Profession {
26  FARMER(0),
28  PRIEST(2),
30  BUTCHER(4);
31 
32  private static final Profession[] professions = new Profession[Profession.values().length];
33  private final int id;
34 
35  static {
36  for (Profession type : values()) {
37  professions[type.getId()] = type;
38  }
39  }
40 
41  private Profession(int id) {
42  this.id = id;
43  }
44 
50  public int getId() {
51  return id;
52  }
53 
60  public static Profession getProfession(int id) {
61  return (id >= professions.length) ? null : professions[id];
62  }
63  }
64 }