Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 34 lines 768 B view raw
1package org.bukkit; 2 3import java.util.HashMap; 4import java.util.Map; 5 6public enum Instrument { 7 8 PIANO((byte) 0x0), // All other 9 BASS_DRUM((byte) 0x1), // Stone 10 SNARE_DRUM((byte) 0x2), // Sand 11 STICKS((byte) 0x3), // Glass 12 BASS_GUITAR((byte) 0x4); // Wood 13 14 private final byte type; 15 private final static Map<Byte, Instrument> types = new HashMap<Byte, Instrument>(); 16 17 private Instrument(byte type) { 18 this.type = type; 19 } 20 21 public byte getType() { 22 return this.type; 23 } 24 25 public static Instrument getByType(final byte type) { 26 return types.get(type); 27 } 28 29 static { 30 for (Instrument instrument : Instrument.values()) { 31 types.put(instrument.getType(), instrument); 32 } 33 } 34}