Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
Achievement.java
Go to the documentation of this file.
1 package org.bukkit;
2 
3 import java.util.Map;
4 
5 import com.google.common.collect.Maps;
6 
10 public enum Achievement {
21  COOK_FISH(10),
22  ON_A_RAIL(11),
25  KILL_COW(14),
26  FLY_PIG(15),
34  THE_END(23),
36  OVERKILL(25),
37  BOOKCASE(26);
38 
42  public final static int STATISTIC_OFFSET = 0x500000;
43  private final static Map<Integer, Achievement> BY_ID = Maps.newHashMap();
44  private final int id;
45 
46  private Achievement(int id) {
47  this.id = STATISTIC_OFFSET + id;
48  }
49 
57  public int getId() {
58  return id;
59  }
60 
69  public static Achievement getById(int id) {
70  return BY_ID.get(id);
71  }
72 
73  static {
74  for (Achievement achievement : values()) {
75  BY_ID.put(achievement.id, achievement);
76  }
77  }
78 }