Search code examples
javaminecraftbukkit

How to use noteblockapi bukkit?


Hey I am trying to make a minecraft plugin so when a player joins it plays that custom sound.

I have looked into some stuff such as noteblockapi and was wondering if anyone could help me on how I could get it to play this custom .nbs

    @EventHandler
public void onPlayerJoin()
{

    //Player.playSound(file.nbs)

}

Solution

  • Using NoteblockAPI to play songs

    Song s = NBSDecoder.parse(new File(getDataFolder(), "Song.nbs"));
    SongPlayer sp = new RadioSongPlayer(s);
    sp.setAutoDestroy(true);
    sp.addPlayer(e.getPlayer());
    sp.setPlaying(true);