Search in sources :

Example 1 with SongPlayer

use of com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer in project Nexus by ProjectEdenGG.

the class RadioFeature method onStop.

@Override
public void onStop() {
    RadioConfigService configService = new RadioConfigService();
    RadioConfig radioConfig = configService.get0();
    RadioUserService userService = new RadioUserService();
    RadioUser user;
    for (Radio radio : radioConfig.getRadios()) {
        if (radio.getSongPlayer() != null) {
            SongPlayer songPlayer = radio.getSongPlayer();
            for (UUID uuid : songPlayer.getPlayerUUIDs()) {
                user = userService.get(uuid);
                user.setServerRadioId(radio.getId());
                userService.save(user);
            }
            removeSongPlayer(radio.getSongPlayer());
        }
    }
    configService.save(radioConfig);
}
Also used : RadioConfigService(gg.projecteden.nexus.models.radio.RadioConfigService) PositionSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.PositionSongPlayer) SongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer) RadioSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer) RadioUser(gg.projecteden.nexus.models.radio.RadioUser) RadioConfig(gg.projecteden.nexus.models.radio.RadioConfig) Radio(gg.projecteden.nexus.models.radio.RadioConfig.Radio) RadioUtils.isInRangeOfRadiusRadio(gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio) UUID(java.util.UUID) RadioUserService(gg.projecteden.nexus.models.radio.RadioUserService)

Example 2 with SongPlayer

use of com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer in project Nexus by ProjectEdenGG.

the class Listeners method onSongNext.

@EventHandler
public void onSongNext(SongNextEvent event) {
    SongPlayer songPlayer = event.getSongPlayer();
    Song song = songPlayer.getSong();
    Set<UUID> UUIDList = songPlayer.getPlayerUUIDs();
    for (UUID uuid : UUIDList) {
        Player player = Bukkit.getPlayer(uuid);
        if (player == null || !player.isOnline())
            continue;
        if (songPlayer instanceof PositionSongPlayer) {
            Radio radio = RadioUtils.getRadio(songPlayer);
            if (radio != null) {
                if (RadioUtils.isInRangeOfRadiusRadio(player, radio))
                    RadioUtils.actionBar(player, song, true);
            }
        } else
            RadioUtils.actionBar(player, song, true);
    }
}
Also used : PositionSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.PositionSongPlayer) Song(com.xxmicloxx.NoteBlockAPI.model.Song) RadioUtils.removePlayer(gg.projecteden.nexus.features.radio.RadioUtils.removePlayer) SongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer) RadioUtils.addPlayer(gg.projecteden.nexus.features.radio.RadioUtils.addPlayer) Player(org.bukkit.entity.Player) PositionSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.PositionSongPlayer) SongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer) PositionSongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.PositionSongPlayer) Radio(gg.projecteden.nexus.models.radio.RadioConfig.Radio) UUID(java.util.UUID) EventHandler(org.bukkit.event.EventHandler)

Example 3 with SongPlayer

use of com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer in project Nexus by ProjectEdenGG.

the class RadioCommand method songInfo.

@Path("info")
@Description("Shows info about the radio you are listening to")
void songInfo() {
    Radio radio = RadioUtils.getListenedRadio(player(), true);
    if (radio == null)
        error("You are not listening to a radio!");
    SongPlayer songPlayer = radio.getSongPlayer();
    Song song = songPlayer.getSong();
    send(PREFIX + "Radio Info:");
    send("&3Radio: &e" + StringUtils.camelCase(radio.getId()));
    List<String> list = RadioUtils.getPlaylistHover(radio);
    send(json("&3Songs: &e[" + list.size() + "]").hover(list).loreize(false));
    send("&3Playing: &e" + song.getTitle() + " &3by &e" + song.getAuthor() + " &3(" + getSongPercent(songPlayer) + "%)");
    line();
}
Also used : RadioSong(gg.projecteden.nexus.models.radio.RadioConfig.RadioSong) Song(com.xxmicloxx.NoteBlockAPI.model.Song) SongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer) Radio(gg.projecteden.nexus.models.radio.RadioConfig.Radio) RadioUtils.getListenedRadio(gg.projecteden.nexus.features.radio.RadioUtils.getListenedRadio) RadioUtils.isInRangeOfRadiusRadio(gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Aggregations

SongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer)3 Radio (gg.projecteden.nexus.models.radio.RadioConfig.Radio)3 Song (com.xxmicloxx.NoteBlockAPI.model.Song)2 PositionSongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.PositionSongPlayer)2 RadioUtils.isInRangeOfRadiusRadio (gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio)2 UUID (java.util.UUID)2 RadioSongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer)1 RadioUtils.addPlayer (gg.projecteden.nexus.features.radio.RadioUtils.addPlayer)1 RadioUtils.getListenedRadio (gg.projecteden.nexus.features.radio.RadioUtils.getListenedRadio)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 RadioConfig (gg.projecteden.nexus.models.radio.RadioConfig)1 RadioSong (gg.projecteden.nexus.models.radio.RadioConfig.RadioSong)1 RadioConfigService (gg.projecteden.nexus.models.radio.RadioConfigService)1 RadioUser (gg.projecteden.nexus.models.radio.RadioUser)1 RadioUserService (gg.projecteden.nexus.models.radio.RadioUserService)1 Player (org.bukkit.entity.Player)1 EventHandler (org.bukkit.event.EventHandler)1