Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Instrument.java
1 package org.bukkit;
2 
3 import java.util.Map;
4 
5 import com.google.common.collect.Maps;
6 
7 public enum Instrument {
8 
9  /**
10  * Piano is the standard instrument for a note block.
11  */
12  PIANO(0x0),
13  /**
14  * Bass drum is normally played when a note block is on top of a
15  * stone-like block
16  */
17  BASS_DRUM(0x1),
18  /**
19  * Snare drum is normally played when a note block is on top of a sandy
20  * block.
21  */
22  SNARE_DRUM(0x2),
23  /**
24  * Sticks are normally played when a note block is on top of a glass
25  * block.
26  */
27  STICKS(0x3),
28  /**
29  * Bass guitar is normally played when a note block is on top of a wooden
30  * block.
31  */
33 
34  private final byte type;
35  private final static Map<Byte, Instrument> BY_DATA = Maps.newHashMap();
36 
37  private Instrument(final int type) {
38  this.type = (byte) type;
39  }
40 
41  /**
42  * @return The type ID of this instrument.
43  * @deprecated Magic value
44  */
45  @Deprecated
46  public byte getType() {
47  return this.type;
48  }
49 
50  /**
51  * Get an instrument by its type ID.
52  *
53  * @param type The type ID
54  * @return The instrument
55  * @deprecated Magic value
56  */
57  @Deprecated
58  public static Instrument getByType(final byte type) {
59  return BY_DATA.get(type);
60  }
61 
62  static {
63  for (Instrument instrument : Instrument.values()) {
64  BY_DATA.put(instrument.getType(), instrument);
65  }
66  }
67 }
static Instrument getByType(final byte type)
Definition: Instrument.java:58