Search in sources :

Example 1 with RadioConfig

use of gg.projecteden.nexus.models.radio.RadioConfig in project Nexus by ProjectEdenGG.

the class RadioFeature method setupRadios.

private void setupRadios() {
    RadioConfigService configService = new RadioConfigService();
    RadioConfig radioConfig = configService.get0();
    for (Radio radio : radioConfig.getRadios()) {
        if (!radio.isEnabled())
            continue;
        Playlist playlist = radio.getPlaylist();
        if (playlist == null || playlist.getSongList().size() <= 0) {
            Nexus.severe(radio.getId() + " radio playlist is empty!");
            continue;
        }
        createSongPlayer(radio, playlist);
    }
    configService.save(radioConfig);
}
Also used : Playlist(com.xxmicloxx.NoteBlockAPI.model.Playlist) RadioConfigService(gg.projecteden.nexus.models.radio.RadioConfigService) RadioConfig(gg.projecteden.nexus.models.radio.RadioConfig) Radio(gg.projecteden.nexus.models.radio.RadioConfig.Radio) RadioUtils.isInRangeOfRadiusRadio(gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio)

Example 2 with RadioConfig

use of gg.projecteden.nexus.models.radio.RadioConfig 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)

Aggregations

RadioUtils.isInRangeOfRadiusRadio (gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio)2 RadioConfig (gg.projecteden.nexus.models.radio.RadioConfig)2 Radio (gg.projecteden.nexus.models.radio.RadioConfig.Radio)2 RadioConfigService (gg.projecteden.nexus.models.radio.RadioConfigService)2 Playlist (com.xxmicloxx.NoteBlockAPI.model.Playlist)1 PositionSongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.PositionSongPlayer)1 RadioSongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer)1 SongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer)1 RadioUser (gg.projecteden.nexus.models.radio.RadioUser)1 RadioUserService (gg.projecteden.nexus.models.radio.RadioUserService)1 UUID (java.util.UUID)1