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);
}
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);
}
Aggregations