Bukkit  1.5.2-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
TreeSpecies.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 TreeSpecies {
11 
15  GENERIC(0x0),
19  REDWOOD(0x1),
23  BIRCH(0x2),
27  JUNGLE(0x3);
28 
29  private final byte data;
30  private final static Map<Byte, TreeSpecies> BY_DATA = Maps.newHashMap();
31 
32  private TreeSpecies(final int data) {
33  this.data = (byte) data;
34  }
35 
41  public byte getData() {
42  return data;
43  }
44 
52  public static TreeSpecies getByData(final byte data) {
53  return BY_DATA.get(data);
54  }
55 
56  static {
57  for (TreeSpecies species : values()) {
58  BY_DATA.put(species.data, species);
59  }
60  }
61 }