use of com.xxmicloxx.NoteBlockAPI.model.Song in project Nexus by ProjectEdenGG.
the class JukeboxUser method preview.
public void preview(JukeboxSong jukeboxSong) {
cancel();
final Song song = jukeboxSong.getSong();
final RadioSongPlayer songPlayer = new RadioSongPlayer(song);
songPlayer.addPlayer(getOnlinePlayer());
songPlayer.setStereo(true);
songPlayer.setPlaying(true);
songPlayer.setCategory(SoundCategory.RECORDS);
this.songPlayer = songPlayer;
}
use of com.xxmicloxx.NoteBlockAPI.model.Song in project Nexus by ProjectEdenGG.
the class JukeboxUser method play.
public void play(JukeboxSong jukeboxSong, int tick) {
cancel();
final Song song = jukeboxSong.getSong();
final PositionSongPlayer songPlayer = new PositionSongPlayer(song);
updatePlayers(songPlayer);
songPlayer.setTargetLocation(getLocation());
songPlayer.setPlaying(true);
songPlayer.setTick((short) tick);
songPlayer.setCategory(SoundCategory.RECORDS);
this.currentSong = jukeboxSong.getName();
this.songPlayer = songPlayer;
this.taskIds.add(Tasks.repeat(0, 1, () -> {
if (!isOnline()) {
cancel();
return;
}
songPlayer.setTargetLocation(getLocation());
updatePlayers(songPlayer);
}));
}
use of com.xxmicloxx.NoteBlockAPI.model.Song in project Depenizen by DenizenScript.
the class NBSCommand method execute.
@Override
public void execute(ScriptEntry scriptEntry) {
ElementTag file = scriptEntry.getObjectTag("file");
ElementTag action = scriptEntry.getObjectTag("action");
List<PlayerTag> targets = (List<PlayerTag>) scriptEntry.getObject("targets");
if (scriptEntry.dbCallShouldDebug()) {
Debug.report(scriptEntry, getName(), action, db("targets", targets), file);
}
if (targets == null || targets.isEmpty()) {
Debug.echoError(scriptEntry, "Targets not found!");
return;
}
if (action.asString().equalsIgnoreCase("play")) {
if (file == null) {
Debug.echoError(scriptEntry, "File not specified!");
return;
}
String directory = URLDecoder.decode(System.getProperty("user.dir"));
Song s = NBSDecoder.parse(new File(directory + "/plugins/Denizen/" + file + ".nbs"));
SongPlayer sp = new RadioSongPlayer(s);
sp.setAutoDestroy(true);
for (PlayerTag p : targets) {
sp.addPlayer(p.getPlayerEntity());
}
sp.setPlaying(true);
} else if (action.asString().equalsIgnoreCase("stop")) {
for (PlayerTag p : targets) {
NoteBlockAPI.stopPlaying(p.getPlayerEntity());
}
}
}
Aggregations