Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
Instrument.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 
7 public enum Instrument {
8 
12  PIANO(0x0),
16  BASS_DRUM(0x1),
20  SNARE_DRUM(0x2),
24  STICKS(0x3),
29 
30  private final byte type;
31  private final static Map<Byte, Instrument> BY_DATA = Maps.newHashMap();
32 
33  private Instrument(final int type) {
34  this.type = (byte) type;
35  }
36 
40  public byte getType() {
41  return this.type;
42  }
43 
49  public static Instrument getByType(final byte type) {
50  return BY_DATA.get(type);
51  }
52 
53  static {
54  for (Instrument instrument : Instrument.values()) {
55  BY_DATA.put(instrument.getType(), instrument);
56  }
57  }
58 }