Search in sources :

Example 6 with Song

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;
}
Also used : Song(com.xxmicloxx.NoteBlockAPI.model.Song) RadioSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer)

Example 7 with Song

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);
    }));
}
Also used : PositionSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.PositionSongPlayer) Song(com.xxmicloxx.NoteBlockAPI.model.Song)

Example 8 with Song

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());
        }
    }
}
Also used : Song(com.xxmicloxx.NoteBlockAPI.model.Song) SongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer) RadioSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer) PlayerTag(com.denizenscript.denizen.objects.PlayerTag) RadioSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer) List(java.util.List) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag) File(java.io.File)

Aggregations

Song (com.xxmicloxx.NoteBlockAPI.model.Song)8 RadioSongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer)3 SongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer)3 File (java.io.File)3 PositionSongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.PositionSongPlayer)2 Radio (gg.projecteden.nexus.models.radio.RadioConfig.Radio)2 List (java.util.List)2 PlayerTag (com.denizenscript.denizen.objects.PlayerTag)1 ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)1 MonoMode (com.xxmicloxx.NoteBlockAPI.model.playmode.MonoMode)1 MonoStereoMode (com.xxmicloxx.NoteBlockAPI.model.playmode.MonoStereoMode)1 StereoMode (com.xxmicloxx.NoteBlockAPI.model.playmode.StereoMode)1 EntitySongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.EntitySongPlayer)1 NBSDecoder (com.xxmicloxx.NoteBlockAPI.utils.NBSDecoder)1 RadioUtils.addPlayer (gg.projecteden.nexus.features.radio.RadioUtils.addPlayer)1 RadioUtils.getListenedRadio (gg.projecteden.nexus.features.radio.RadioUtils.getListenedRadio)1 RadioUtils.isInRangeOfRadiusRadio (gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio)1 RadioUtils.removePlayer (gg.projecteden.nexus.features.radio.RadioUtils.removePlayer)1 Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)1 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)1