org.bukkit.Note Java Examples

The following examples show how to use org.bukkit.Note. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CraftNoteBlock.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        CraftWorld world = (CraftWorld) this.getWorld();
        world.getHandle().addBlockEvent(new BlockPos(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
 
Example #2
Source File: CraftNoteBlock.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean play(Instrument instrument, Note note) {
    Block block = getBlock();

    if (block.getType() == Material.NOTE_BLOCK) {
        world.getHandle().addBlockEvent(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
        return true;
    } else {
        return false;
    }
}
 
Example #3
Source File: NotePlayEvent.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public NotePlayEvent(Block block, Instrument instrument, Note note) {
    super(block);
    this.instrument = instrument;
    this.note = note;
}
 
Example #4
Source File: NotePlayEvent.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Overrides the {@link Note} to be played.
 *
 * @param note the Note. Has no effect if null.
 */
public void setNote(Note note) {
    if (note != null) {
        this.note = note;
    }
}
 
Example #5
Source File: CraftNoteBlock.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Note getNote() {
    return new Note(this.getSnapshot().note);
}
 
Example #6
Source File: CraftNoteBlock.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setNote(Note note) {
    this.getSnapshot().note = note.getId();
}
 
Example #7
Source File: CraftNoteBlock.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public Note getNote() {
    return new Note(note.note);
}
 
Example #8
Source File: CraftNoteBlock.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public void setNote(Note n) {
    note.note = n.getId();
}
 
Example #9
Source File: NoteBlock.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Gets the note.
 *
 * @return The note.
 */
public Note getNote();
 
Example #10
Source File: NoteBlock.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Set the note.
 *
 * @param note The note.
 */
public void setNote(Note note);
 
Example #11
Source File: NoteBlock.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Plays an arbitrary note with an arbitrary instrument at the block.
 * <p>
 * If the block represented by this block state is no longer a note block,
 * this will return false.
 *
 * @param instrument The instrument
 * @param note       The note
 * @return true if successful, otherwise false
 * @throws IllegalStateException if this block state is not placed
 * @see Instrument Note
 */
public boolean play(Instrument instrument, Note note);
 
Example #12
Source File: NotePlayEvent.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Gets the {@link Note} to be played.
 *
 * @return the Note.
 */
public Note getNote() {
    return note;
}