本文整理汇总了Java中org.bukkit.entity.Player.playNote方法的典型用法代码示例。如果您正苦于以下问题:Java Player.playNote方法的具体用法?Java Player.playNote怎么用?Java Player.playNote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.playNote方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playTick
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void playTick(Player p, int tick) {
if (noteBlock.getType() != Material.NOTE_BLOCK) {
return;
}
if (!p.getWorld().getName().equals(noteBlock.getWorld().getName())) {
// not in same world
return;
}
byte playerVolume = NoteBlockPlayerMain.getPlayerVolume(p);
for (Layer l : song.getLayerHashMap().values()) {
Note note = l.getNote(tick);
if (note == null) {
continue;
}
p.playNote(noteBlock.getLocation(), Instrument.getBukkitInstrument(note.getInstrument()),
new org.bukkit.Note(note.getKey() - 33));
p.playSound(noteBlock.getLocation(),
Instrument.getInstrument(note.getInstrument()),
(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
NotePitch.getPitch(note.getKey() - 33));
}
}
示例2: playTick
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void playTick(Player p, int tick) {
if (noteBlock.getType() != Material.NOTE_BLOCK) {
return;
}
if (!p.getWorld().getName().equals(noteBlock.getWorld().getName())) {
// not in same world
return;
}
byte playerVolume = MusicManager.getPlayerVolume(p);
for (Layer l : song.getLayerHashMap().values()) {
Note note = l.getNote(tick);
if (note == null) {
continue;
}
p.playNote(noteBlock.getLocation(), Instrument.getBukkitInstrument(note.getInstrument()),
new org.bukkit.Note(note.getKey() - 33));
p.playSound(noteBlock.getLocation(),
Instrument.getInstrument(note.getInstrument()),
(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
NotePitch.getPitch(note.getKey() - 33));
}
}
示例3: run
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
/*for (Player p : ServerUtil.getPlayers()) {
//p.playNote(p.getLocation(), Instrument.GUITAR, Note.natural(1, Tone.A));
//p.getWorld().playSound(p.getLocation(), Sound.BLOCK_NOTE_GUITAR, 10, 1);
}*/
for (Player p : ServerUtil.getPlayers()) {
p.playNote(p.getLocation(), Instrument.PIANO, MusicPlayer.translateMusicFileToNotes("test", 1).get(note));
p.playNote(p.getLocation(), Instrument.PIANO, MusicPlayer.translateMusicFileToNotes("test", 2).get(note));
note++;
if (MusicPlayer.translateMusicFileToNotes("test", 1).size() == note) {
note = 0;
}
}
}
示例4: getEmerald
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void getEmerald(PlayerPickupItemEvent e){
Player p = e.getPlayer();
String uuid = p.getUniqueId().toString();
if(e.getItem().getItemStack().getType().equals(Material.EMERALD)){
e.setCancelled(true);
int amount = e.getItem().getItemStack().getAmount();
e.getItem().remove();
setEmeralds(uuid, getEmeralds(uuid)+amount);
p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.A));
}
}
示例5: pstp
import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void pstp(Player p){
p.playNote(p.getLocation(), Instrument.PIANO, Note.sharp(1, Tone.F));
}