Added Instrument enum, Note class and get/setNote functions. Thanks xZise!

By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
Bukkit/Spigot
2011-06-17 03:00:49 -04:00
parent e7815b7313
commit f1a6e194ef
4 changed files with 284 additions and 4 deletions

View File

@@ -0,0 +1,34 @@
package org.bukkit;
import java.util.HashMap;
import java.util.Map;
public enum Instrument {
PIANO((byte) 0x0), // All other
BASS_DRUM((byte) 0x1), // Stone
SNARE_DRUM((byte) 0x2), // Sand
STICKS((byte) 0x3), // Glass
BASS_GUITAR((byte) 0x4); // Wood
private final byte type;
private final static Map<Byte, Instrument> types = new HashMap<Byte, Instrument>();
private Instrument(byte type) {
this.type = type;
}
public byte getType() {
return this.type;
}
public static Instrument getByType(final byte type) {
return types.get(type);
}
static {
for (Instrument instrument : Instrument.values()) {
types.put(instrument.getType(), instrument);
}
}
}