Search in sources :

Example 1 with EntitySongPlayer

use of com.xxmicloxx.NoteBlockAPI.songplayer.EntitySongPlayer in project TrollV4 by DxsSucuk.

the class PlayMusic method play.

/**
 * Plays Musik(.nbs) with NoteBlocks.
 *
 * @param p the player that should hear the song.
 * @param PATH the full file path.
 * @since 4.4.4
 */
public static void play(Player p, String PATH) {
    if (new File(PATH).exists()) {
        Song song = NBSDecoder.parse(new File(PATH));
        EntitySongPlayer esp = new EntitySongPlayer(song);
        esp.setEntity(p);
        esp.setDistance(16);
        esp.addPlayer(p);
        esp.setPlaying(true);
    } else {
        if (!new File("plugins/TrollV4/rick.nbs").exists()) {
            Main.logger.info("Downloading Rick.nbs!");
            Main.download("https://cdn.azura.best/download/trollv4/uni/rick.nbs", "plugins/TrollV4/rick.nbs");
            if (new File("plugins/TrollV4/rick.nbs").exists()) {
                Main.logger.info("Downloaded Rick.nbs!");
            } else {
                Main.logger.info("Couldnt download Rick.nbs!");
            }
        } else if (!new File("plugins/TrollV4/giorno.nbs").exists()) {
            Main.logger.info("Downloading Giorno.nbs!");
            Main.download("https://cdn.azura.best/download/trollv4/uni/giorno.nbs", "plugins/TrollV4/giorno.nbs");
            if (new File("plugins/TrollV4/giorno.nbs").exists()) {
                Main.logger.info("Downloaded Giorno.nbs!");
            } else {
                Main.logger.info("Couldnt download Giorno.nbs!");
            }
        }
    }
}
Also used : Song(com.xxmicloxx.NoteBlockAPI.model.Song) EntitySongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.EntitySongPlayer) File(java.io.File)

Aggregations

Song (com.xxmicloxx.NoteBlockAPI.model.Song)1 EntitySongPlayer (com.xxmicloxx.NoteBlockAPI.songplayer.EntitySongPlayer)1 File (java.io.File)1