use of com.xxmicloxx.NoteBlockAPI.model.playmode.MonoStereoMode in project JoinMusic by T0biii.
the class Music method playSong.
private static void playSong(Player player, Main plugin) {
try {
File songFile;
if (plugin.getConfig().getBoolean("options.music.random")) {
songFile = SelectRandomFileFromFolder(plugin);
} else {
songFile = new File(plugin.getDataFolder() + "/" + plugin.getConfig().getString("music"));
}
Song s = NBSDecoder.parse(songFile);
final RadioSongPlayer sp = new RadioSongPlayer(s);
sp.addPlayer(player);
sp.setPlaying(true);
int volume = plugin.getConfig().getInt("options.music.Volume");
if (volume >= 0 && volume <= 100) {
sp.setVolume((byte) volume);
} else {
plugin.log.warning(plugin.cprefix + "ERROR: Volume must be between 0-100 (Your Value: " + volume + ")");
}
if (plugin.getConfig().getBoolean("options.music.10Octave")) {
sp.setEnable10Octave(true);
}
String mode = plugin.getConfig().getString("options.music.Mode");
if (mode.equalsIgnoreCase("MonoMode")) {
sp.setChannelMode(new MonoMode());
} else if (mode.equalsIgnoreCase("MonoStereoMode")) {
sp.setChannelMode(new MonoStereoMode());
} else if (mode.equalsIgnoreCase("StereoMode")) {
sp.setChannelMode(new StereoMode());
} else {
sp.setChannelMode(new MonoMode());
}
playingSong.put(player.getUniqueId(), sp);
String playingMessage = plugin.getConfig().getString("messages.playing");
playingMessage = replacePlaceholders(player, playingMessage);
if (!playingMessage.isEmpty() && plugin.getConfig().getBoolean("options.printSongTitel")) {
player.sendMessage(plugin.prefix + playingMessage.replaceAll("&", "ยง"));
}
} catch (IllegalArgumentException e) {
System.err.println(plugin.cprefix + "No sounds detected");
}
}
Aggregations