public static NotePlayEvent callNotePlayEvent(
     World world, int x, int y, int z, byte instrument, byte note) {
   NotePlayEvent event =
       new NotePlayEvent(
           new BukkitBlock(new BukkitChunk(world.getChunkFromBlockCoords(x, z)), x, y, z),
           org.bukkit.Instrument.getByType(instrument),
           new org.bukkit.Note(note));
   Bukkit.getServer().getPluginManager().callEvent(event);
   return event;
 }
Ejemplo n.º 2
0
  // FIXME
  public boolean play(byte instrument, byte note) {
    Block block = getBlock();

    synchronized (block) {
      if (block.getType() == Material.NOTE_BLOCK) {
        this.play(Instrument.getByType(instrument), Note.natural(0, Note.Tone.getById(note)));
        return true;
      } else {
        return false;
      }
    }
  }
 /**
  * Get the instrument type.
  *
  * @return Instrument type.
  */
 @SuppressWarnings("deprecation")
 public Instrument getInstrument() {
   return Instrument.getByType(getByte1());
 }