All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.Instrument Maven / Gradle / Ivy

package org.bukkit;

import com.google.common.collect.Maps;

import java.util.Map;

public enum Instrument {

  /**
   * Piano is the standard instrument for a note block.
   */
  PIANO(0x0),
  /**
   * Bass drum is normally played when a note block is on top of a
   * stone-like block
   */
  BASS_DRUM(0x1),
  /**
   * Snare drum is normally played when a note block is on top of a sandy
   * block.
   */
  SNARE_DRUM(0x2),
  /**
   * Sticks are normally played when a note block is on top of a glass
   * block.
   */
  STICKS(0x3),
  /**
   * Bass guitar is normally played when a note block is on top of a wooden
   * block.
   */
  BASS_GUITAR(0x4);

  private final static Map BY_DATA = Maps.newHashMap();

  static {
    for (Instrument instrument : Instrument.values()) {
      BY_DATA.put(instrument.getType(), instrument);
    }
  }

  private final byte type;

  Instrument(final int type) {
    this.type = (byte) type;
  }

  /**
   * Get an instrument by its type ID.
   *
   * @param type The type ID
   * @return The instrument
   * @deprecated Magic value
   */
  @Deprecated
  public static Instrument getByType(final byte type) {
    return BY_DATA.get(type);
  }

  /**
   * @return The type ID of this instrument.
   * @deprecated Magic value
   */
  @Deprecated
  public byte getType() {
    return this.type;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy