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