Solved Notes mixing together

Discussion in 'Plugin Development' started by Waterpig, Jul 7, 2019.

  1. Offline

    Waterpig

    Just to start off, I am still new to java so this might be a dumb error with the time.

    I wanted to create a simple plugin that plays a specific song when you use a specific command, but the notes just kinda mix together and play at once.

    This is the way i play the notes

    Code:
    Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                    @Override
                    public void run() {
                        p.playNote(l, Instrument.PIANO, Note.flat(1, Tone.E));
                    }
                }, s1);
                Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                    @Override
                    public void run() {
                        p.playNote(l, Instrument.PIANO, Note.flat(1, Tone.E));
                    }
                }, s1);
    The "s" variables are of course "long" and "p" is the player.

    Am i supposed to stopSound after every note? And if so, how exactly, because the BLOCK_NOTE_BLOCK_PIANO doesnt seem to exist?
     
  2. Online

    timtower Ninja on the waves Moderator

    @Waterpig That is probably because they are send at the same tick.
     
  3. Offline

    Waterpig

    Oh so that's how
    scheduleSyncDelayedTask works. Thanks for just giving me a small hint on my otherwise dumb question
     

Share This Page