Search in sources :

Example 1 with SongPlayer

use of xyz.derkades.ublisk.ext.com.xxmicloxx.noteblockapi.SongPlayer in project Ublisk by Derkades.

the class SongEnd method musicStopped.

@EventHandler
public void musicStopped(SongEndEvent event) {
    try {
        SongPlayer songPlayer = event.getSongPlayer();
        for (String playername : songPlayer.getPlayerList()) {
            UPlayer player = new UPlayer(playername);
            if (player.getSetting(Setting.PLAY_MUSIC)) {
                Town town = player.getTown();
                if (town != null) {
                    town.playThemeToPlayer(player);
                }
            }
        }
        songPlayer.destroy();
    } catch (PlayerNotFoundException e) {
        Logger.log(LogLevel.WARNING, "Music", "Tried to play new song but player has already logged out");
    }
}
Also used : UPlayer(xyz.derkades.ublisk.utils.UPlayer) SongPlayer(xyz.derkades.ublisk.ext.com.xxmicloxx.noteblockapi.SongPlayer) Town(xyz.derkades.ublisk.Town) PlayerNotFoundException(xyz.derkades.ublisk.utils.exception.PlayerNotFoundException) EventHandler(org.bukkit.event.EventHandler)

Aggregations

EventHandler (org.bukkit.event.EventHandler)1 Town (xyz.derkades.ublisk.Town)1 SongPlayer (xyz.derkades.ublisk.ext.com.xxmicloxx.noteblockapi.SongPlayer)1 UPlayer (xyz.derkades.ublisk.utils.UPlayer)1 PlayerNotFoundException (xyz.derkades.ublisk.utils.exception.PlayerNotFoundException)1