本文整理汇总了Java中org.bukkit.Sound.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java Sound.valueOf方法的具体用法?Java Sound.valueOf怎么用?Java Sound.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.Sound
的用法示例。
在下文中一共展示了Sound.valueOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.bukkit.Sound; //导入方法依赖的package包/类
public static Sound get(String v18, String v19) {
Sound sound = null;
try {
sound = Sound.valueOf(v18);
if (sound.equals(null)) {
sound = Sound.valueOf(v19);
}
} catch (Exception ex) {
}
return sound;
}
示例2: onVoucherReward
import org.bukkit.Sound; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onVoucherReward(RVRewardEvent e) {
Player p = e.getPlayer();
String rw = e.getReward();
Voucher v = e.getVoucher();
String reward = rw
.replace("%x%", "" + p.getLocation().getBlockX())
.replace("%y%", "" + p.getLocation().getBlockY())
.replace("%z%", "" + p.getLocation().getBlockZ())
.replace("%tier%", v.getId())
.replace("%player%", p.getName())
.replace("%limit%", "" + v.getLimit());
switch (getType(e.getAction())) {
case "CONSOLE_COMMAND":
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), reward);
break;
case "PLAYER_COMMAND":
p.performCommand(reward);
break;
case "TELL_PLAYER":
p.sendMessage(ColorUtil.translate(reward));
break;
case "BROADCAST":
Bukkit.broadcastMessage(ColorUtil.translate(reward));
break;
case "PLAY_SOUND":
Sound s = Sound.valueOf(reward);
p.playSound(p.getLocation(), s, 3, 3);
break;
case "PLAYER_TITLE":
String title = reward.contains(";") ? reward.split(";")[0] : reward;
String sub = reward.contains(";") ? reward.split(";")[1] : "";
p.sendTitle(ColorUtil.translate(title), ColorUtil.translate(sub));
break;
case "CENTER_MESSAGE":
CenterUtil.sendCenteredMessage(p, reward);
break;
case "CENTER_BROADCAST":
for (Player player : Bukkit.getOnlinePlayers()) {
CenterUtil.sendCenteredMessage(player, reward);
}
break;
case "PLAYER_CHAT":
p.sendMessage(ColorUtil.translate(reward));
break;
case "FIREWORK":
Firework fw = p.getWorld().spawn(p.getLocation(), Firework.class);
//use meta to customize the firework or add parameters to the method
fw.setVelocity(p.getLocation().getDirection().multiply(50));
fw.setGlowing(true);
break;
}
}
示例3: getSound
import org.bukkit.Sound; //导入方法依赖的package包/类
/**
* Returns the sound and throws exception if the sound does not exist
*
* @return sound
* @throws Exception exception
*/
public Sound getSound() throws Exception {
return Sound.valueOf(this.text);
}