Add some testing

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
Bukkit/Spigot
2012-01-29 11:10:40 +01:00
parent ae0eb736d1
commit ac2271958e
34 changed files with 871 additions and 281 deletions

View File

@@ -1,21 +1,22 @@
package org.bukkit;
import java.util.HashMap;
import java.util.Map;
import com.google.common.collect.Maps;
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
PIANO(0x0), // All other
BASS_DRUM(0x1), // Stone
SNARE_DRUM(0x2), // Sand
STICKS(0x3), // Glass
BASS_GUITAR(0x4); // Wood
private final byte type;
private final static Map<Byte, Instrument> types = new HashMap<Byte, Instrument>();
private final static Map<Byte, Instrument> BY_DATA = Maps.newHashMap();
private Instrument(byte type) {
this.type = type;
private Instrument(final int type) {
this.type = (byte) type;
}
public byte getType() {
@@ -23,12 +24,12 @@ public enum Instrument {
}
public static Instrument getByType(final byte type) {
return types.get(type);
return BY_DATA.get(type);
}
static {
for (Instrument instrument : Instrument.values()) {
types.put(instrument.getType(), instrument);
BY_DATA.put(instrument.getType(), instrument);
}
}
}