summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/Instrument.java
blob: e54d0a2ace17f5f259d822cd519e36027b6affa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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);
        }
    }
}