Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Villager.java
1 package org.bukkit.entity;
2 
3 /**
4  * Represents a villager NPC
5  */
6 public interface Villager extends Ageable, NPC {
7 
8  /**
9  * Gets the current profession of this villager.
10  *
11  * @return Current profession.
12  */
13  public Profession getProfession();
14 
15  /**
16  * Sets the new profession of this villager.
17  *
18  * @param profession New profession.
19  */
20  public void setProfession(Profession profession);
21 
22 
23  /**
24  * Represents the various different Villager professions there may be.
25  */
26  public enum Profession {
27  FARMER(0),
28  LIBRARIAN(1),
29  PRIEST(2),
30  BLACKSMITH(3),
31  BUTCHER(4);
32 
33  private static final Profession[] professions = new Profession[Profession.values().length];
34  private final int id;
35 
36  static {
37  for (Profession type : values()) {
38  professions[type.getId()] = type;
39  }
40  }
41 
42  private Profession(int id) {
43  this.id = id;
44  }
45 
46  /**
47  * Gets the ID of this profession.
48  *
49  * @return Profession ID.
50  * @deprecated Magic value
51  */
52  @Deprecated
53  public int getId() {
54  return id;
55  }
56 
57  /**
58  * Gets a profession by its ID.
59  *
60  * @param id ID of the profession to get.
61  * @return Resulting profession, or null if not found.
62  * @deprecated Magic value
63  */
64  @Deprecated
65  public static Profession getProfession(int id) {
66  return (id >= professions.length) ? null : professions[id];
67  }
68  }
69 }
void setProfession(Profession profession)
static Profession getProfession(int id)
Definition: Villager.java:65