Java 如何使用noteblockapi bukkit?

Java 如何使用noteblockapi bukkit?,java,minecraft,bukkit,Java,Minecraft,Bukkit,嘿,我正在尝试制作一个minecraft插件,这样当一个玩家加入时,它就会播放自定义的声音 我已经研究了一些东西,比如noteblockapi,想知道是否有人可以帮助我如何让它玩这个定制 @EventHandler public void onPlayerJoin() { //Player.playSound(file.nbs) } 那么根据,你要这个方法, play​(Instrument instrument, Note note) 其中Instrument和Note

嘿,我正在尝试制作一个minecraft插件,这样当一个玩家加入时,它就会播放自定义的声音

我已经研究了一些东西,比如noteblockapi,想知道是否有人可以帮助我如何让它玩这个定制

    @EventHandler
public void onPlayerJoin()
{

    //Player.playSound(file.nbs)

}
那么根据,你要这个方法,

play​(Instrument instrument, Note note)
其中
Instrument
Note
都是
org.bukkit
包中的枚举

因此,您需要创建记事本的BlockState,将其强制转换到
Noteblock
界面,并在其上调用
.play
。可能是这样的:

((NoteBlock)Material.NOTE_BLOCK).play(Instrument.BELL, Note.Tone.A);
根据需要更换乐器和音调。

根据,您需要以下方法:

play​(Instrument instrument, Note note)
其中
Instrument
Note
都是
org.bukkit
包中的枚举

因此,您需要创建记事本的BlockState,将其强制转换到
Noteblock
界面,并在其上调用
.play
。可能是这样的:

((NoteBlock)Material.NOTE_BLOCK).play(Instrument.BELL, Note.Tone.A);
根据需要更换仪器和音调。

使用

使用


嘿,如果我已经有了一个.nbs声音文件,我有没有办法添加它而不是单独播放每个音符?@coolio85不知道。我从未使用过Bukkit,但我知道如何阅读文档。嘿,如果我已经有了一个.nbs声音文件,有没有办法添加它,而不是单独播放每个音符?@coolio85不知道。我从未使用过Bukkit,但我知道如何阅读文档。