Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
CoalType.java
1 package org.bukkit;
2 
3 import java.util.Map;
4 
5 import com.google.common.collect.Maps;
6 
7 /**
8  * Represents the two types of coal
9  */
10 public enum CoalType {
11  COAL(0x0),
12  CHARCOAL(0x1);
13 
14  private final byte data;
15  private final static Map<Byte, CoalType> BY_DATA = Maps.newHashMap();
16 
17  private CoalType(final int data) {
18  this.data = (byte) data;
19  }
20 
21  /**
22  * Gets the associated data value representing this type of coal
23  *
24  * @return A byte containing the data value of this coal type
25  * @deprecated Magic value
26  */
27  @Deprecated
28  public byte getData() {
29  return data;
30  }
31 
32  /**
33  * Gets the type of coal with the given data value
34  *
35  * @param data Data value to fetch
36  * @return The {@link CoalType} representing the given value, or null if
37  * it doesn't exist
38  * @deprecated Magic value
39  */
40  @Deprecated
41  public static CoalType getByData(final byte data) {
42  return BY_DATA.get(data);
43  }
44 
45  static {
46  for (CoalType type : values()) {
47  BY_DATA.put(type.data, type);
48  }
49  }
50 }
static CoalType getByData(final byte data)
Definition: CoalType.java:41