本文整理汇总了Java中org.bukkit.Instrument类的典型用法代码示例。如果您正苦于以下问题:Java Instrument类的具体用法?Java Instrument怎么用?Java Instrument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Instrument类属于org.bukkit包,在下文中一共展示了Instrument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.bukkit.Instrument; //导入依赖的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;
}
}
}
示例2: tellMembers
import org.bukkit.Instrument; //导入依赖的package包/类
public void tellMembers(FancyMessage message) {
if (leader != null) {
Player l = leader.getPlayer().getPlayer();
message.send(l);
l.playNote(l.getLocation(), Instrument.PIANO, Note.natural(1, Tone.C));
l.playNote(l.getLocation(), Instrument.PIANO, Note.natural(1, Tone.G));
l.playNote(l.getLocation(), Instrument.PIANO, Note.natural(1, Tone.E));
}
if (members.isEmpty()) {
return;
}
for (QuestPlayer qp : members) {
if (!qp.getPlayer().isOnline()) {
continue;
}
Player p = qp.getPlayer().getPlayer();
message.send(qp.getPlayer().getPlayer());
p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.C));
p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.G));
p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.E));
}
}
示例3: identifyInstrum
import org.bukkit.Instrument; //导入依赖的package包/类
/**
* Identifies which instrument to play note with
*
* @param instrum Instrument ID
* @return The instrument to use
*/
public Instrument identifyInstrum(String instrum) {
Instrument instrument = null;
if (instrum.equals("BASS_DRUM")) {
instrument = Instrument.BASS_DRUM;
} else if (instrum.equals("BASS_GUITAR")) {
instrument = Instrument.BASS_GUITAR;
} else if (instrum.equals("PIANO")) {
instrument = Instrument.PIANO;
} else if (instrum.equals("SNARE_DRUM")) {
instrument = Instrument.SNARE_DRUM;
} else if (instrum.equals("STICKS")) {
instrument = Instrument.STICKS;
} else {
log.info("Improper instrument " + instrum + ", defaulting to PIANO");
instrument = Instrument.PIANO;
}
return instrument;
}
示例4: play
import org.bukkit.Instrument; //导入依赖的package包/类
@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;
}
}
示例5: getEmerald
import org.bukkit.Instrument; //导入依赖的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));
}
}
示例6: init
import org.bukkit.Instrument; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
noteExpression = (Expression<Note>) expressions[0];
instrumentExpression = (Expression<Instrument>) expressions[1];
blockExpression = (Expression<Block>) expressions[2];
return true;
}
示例7: setInstrument
import org.bukkit.Instrument; //导入依赖的package包/类
/**
* Overrides the {@link Instrument} to be used.
*
* @param instrument the Instrument. Has no effect if null.
*/
public void setInstrument(Instrument instrument) {
if (instrument != null) {
this.instrument = instrument;
}
}
示例8: updateCompass
import org.bukkit.Instrument; //导入依赖的package包/类
public static void updateCompass(QuestPlayer qp, boolean silent) {
if (!qp.getPlayer().isOnline()) {
return;
}
if (!QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getCompassEnabled()) {
return;
}
if (!hasCompass(qp.getPlayer().getPlayer().getInventory())) {
return;
}
Player player = qp.getPlayer().getPlayer();
Location targ = qp.getCompassTarget();
if (targ == null) {
player.setCompassTarget(player.getWorld().getBlockAt(0, 0, 0).getLocation().add(RESET_VECTOR));
} else {
player.setCompassTarget(qp.getCompassTarget());
}
if (!silent) {
player.sendMessage(ChatColor.GRAY + "Your compass has been updated" + ChatColor.RESET);
player.playNote(player.getLocation(), Instrument.PIANO, Note.natural(0, Tone.E));
player.playNote(player.getLocation(), Instrument.PIANO, Note.natural(0, Tone.G));
player.playNote(player.getLocation(), Instrument.PIANO, Note.natural(0, Tone.B));
}
}
示例9: onAction
import org.bukkit.Instrument; //导入依赖的package包/类
@Override
public void onAction() {
// TODO Auto-generated method stub
if (leader.getParty() == null) {
Party party = leader.createParty();
other.joinParty(party);
} else {
other.joinParty(leader.getParty());
}
Player p = other.getPlayer().getPlayer();
p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.C));
p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.G));
p.playNote(p.getLocation(), Instrument.PIANO, Note.natural(1, Tone.E));
}
示例10: play
import org.bukkit.Instrument; //导入依赖的package包/类
@Override
public boolean play(Instrument instrument, Note note) {
Block block = getBlock();
if (block.getType() == Material.NOTE_BLOCK) {
world.getHandle().playBlockAction(getX(), getY(), getZ(), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
return true;
} else {
return false;
}
}
示例11: songOne
import org.bukkit.Instrument; //导入依赖的package包/类
/**
* Plays song1 to player
*
* @param player player
*/
public void songOne(Player player) {
song1 = MoneyThief.plugin.getSongOne();
song2 = MoneyThief.plugin.getSongTwo();
song3 = MoneyThief.plugin.getSongThree();
int i = 0;
int octave;
int type;
String toneS;
long time;
String instrum;
Tone tone;
Instrument instrument;
while (song1.get("" + i) != null) {
octave = song1.getInt(i + ".octave");
type = song1.getInt(i + ".type");
toneS = song1.getString(i + ".tone");
time = song1.getLong(i + ".time");
instrum = song1.getString(i + ".instrum");
tone = identifyTone(toneS);
instrument = identifyInstrum(instrum);
if (type == 0) {
natural(player, tone, octave, instrument, time);
} else if (type == 1) {
sharp(player, tone, octave, instrument, time);
} else if (type == 2) {
flat(player, tone, octave, instrument, time);
}
i++;
}
}
示例12: songTwo
import org.bukkit.Instrument; //导入依赖的package包/类
/**
* Plays song2 to player
*
* @param player player
*/
public void songTwo(Player player) {
song1 = MoneyThief.plugin.getSongOne();
song2 = MoneyThief.plugin.getSongTwo();
song3 = MoneyThief.plugin.getSongThree();
int i = 0;
int octave;
int type;
String toneS;
long time;
String instrum;
Tone tone;
Instrument instrument;
while (song2.get("" + i) != null) {
octave = song2.getInt(i + ".octave");
type = song2.getInt(i + ".type");
toneS = song2.getString(i + ".tone");
time = song2.getLong(i + ".time");
instrum = song2.getString(i + ".instrum");
tone = identifyTone(toneS);
instrument = identifyInstrum(instrum);
if (type == 0) {
natural(player, tone, octave, instrument, time);
} else if (type == 1) {
sharp(player, tone, octave, instrument, time);
} else if (type == 2) {
flat(player, tone, octave, instrument, time);
}
i++;
}
}
示例13: songThree
import org.bukkit.Instrument; //导入依赖的package包/类
/**
* Plays song3 to player
*
* @param player player
*/
public void songThree(Player player) {
song1 = MoneyThief.plugin.getSongOne();
song2 = MoneyThief.plugin.getSongTwo();
song3 = MoneyThief.plugin.getSongThree();
int i = 0;
int octave;
int type;
String toneS;
long time;
String instrum;
Tone tone;
Instrument instrument;
while (song3.get("" + i) != null) {
octave = song3.getInt(i + ".octave");
type = song3.getInt(i + ".type");
toneS = song3.getString(i + ".tone");
time = song3.getLong(i + ".time");
instrum = song3.getString(i + ".instrum");
tone = identifyTone(toneS);
instrument = identifyInstrum(instrum);
if (type == 0) {
natural(player, tone, octave, instrument, time);
} else if (type == 1) {
sharp(player, tone, octave, instrument, time);
} else if (type == 2) {
flat(player, tone, octave, instrument, time);
}
i++;
}
}
示例14: natural
import org.bukkit.Instrument; //导入依赖的package包/类
/**
* Plays a natural note
*
* @param player player
* @param tone note
* @param octave octave
* @param instrum instrument
* @param delay delay
*/
public void natural(Player player, Tone tone, int octave, Instrument instrum, long delay) {
final Player play = player;
final Instrument inst = instrum;
final Note note = Note.natural(octave, tone);
final BukkitScheduler scheduler = MoneyThief.plugin.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(MoneyThief.plugin, new Runnable() {
@Override
public void run() {
play.playNote(play.getLocation(), inst, note);
}
}, delay);
}
示例15: sharp
import org.bukkit.Instrument; //导入依赖的package包/类
/**
* Plays a sharp note
*
* @param player player
* @param tone note
* @param octave octave
* @param instrum instrument
* @param delay delay
*/
public void sharp(Player player, Tone tone, int octave, Instrument instrum, long delay) {
final Player play = player;
final Instrument inst = instrum;
final Note note = Note.sharp(octave, tone);
final BukkitScheduler scheduler = MoneyThief.plugin.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(MoneyThief.plugin, new Runnable() {
@Override
public void run() {
play.playNote(play.getLocation(), inst, note);
}
}, delay);
}