Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- patch: plugins/Skript/music
- import:
- org.bukkit.Bukkit
- java.io.File
- java.util.ArrayList
- java.util.Arrays
- com.xxmicloxx.NoteBlockAPI.event.SongNextEvent
- com.xxmicloxx.NoteBlockAPI.model.Playlist
- com.xxmicloxx.NoteBlockAPI.model.Song
- com.xxmicloxx.NoteBlockAPI.utils.NBSDecoder
- com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer
- on load:
- set {_dir} to new File("{@patch}")
- set {_iter} to Arrays.asList({_dir}.listFiles()).iterator()
- while {_iter}.hasNext():
- set {_file} to {_iter}.next()
- if {_file}.exists() is true:
- if {_file}.isFile() is true:
- set {_song} to NBSDecoder.parse({_file})
- if {_playlist} is not set:
- set {_playlist} to new Playlist({_song})
- else:
- {_playlist}.add({_song})
- set {_pl} to new RadioSongPlayer({_playlist})
- {_pl}.setAutoDestroy(false)
- {_pl}.setPlaying(true)
- set {songplayer} to {_pl}
- loop all players:
- {songplayer}.addPlayer(loop-player)
- on SongNextEvent:
- set {_song} to event.getSongPlayer().getSong()
- set {_iter} to event.getSongPlayer().getPlayerUUIDs().iterator()
- set {_rand} to random integer between 1 and 5
- set {_time} to round({_song}.getLength()/20)
- set {_s} to mod({_time}, 60)
- set {_m} to floor({_time}/60)
- if {_s} < 10:
- set {_s} to "0%{_s}%"
- if {_m} < 10:
- set {_m} to "0%{_m}%"
- while {_iter}.hasNext():
- set {_pl} to Bukkit.getPlayer({_iter}.next())
- if {_pl} is set:
- if {_rand} is 1:
- send {_pl} title "&2&l%{_song}.getTitle()%" with subtitle "&7Autor: &a%{_song}.getAuthor()% &7Czas: &a%{_m}%:%{_s}%"
- else if {_rand} is 2:
- send {_pl} title "&d&l%{_song}.getTitle()%" with subtitle "&7Autor: &3%{_song}.getAuthor()% &7Czas: &3%{_m}%:%{_s}%"
- else if {_rand} is 3:
- send {_pl} title "&3&l%{_song}.getTitle()%" with subtitle "&7Autor: &b%{_song}.getAuthor()% &7Czas: &b%{_m}%:%{_s}%"
- else if {_rand} is 4:
- send {_pl} title "&5&l%{_song}.getTitle()%" with subtitle "&7Autor: &b%{_song}.getAuthor()% &7Czas: &b%{_m}%:%{_s}%"
- else:
- send {_pl} title "&6&l%{_song}.getTitle()%" with subtitle "&2Autor: &e%{_song}.getAuthor()% &7Czas: &e%{_m}%:%{_s}%"
- on script unload:
- {songplayer}.destroy()
- delete {songplayer}
- on join:
- if {songplayer} is set:
- {songplayer}.addPlayer(player)
- on disconnect:
- if {songplayer} is set:
- {songplayer}.removePlayer(player)
Advertisement
Add Comment
Please, Sign In to add comment