mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 09:35:35 -05:00
music bossbar instead of actionbar
not tested but it prob works
This commit is contained in:
parent
2da7195481
commit
f843316c60
1 changed files with 16 additions and 3 deletions
|
@ -45,7 +45,19 @@ function inject (bot) {
|
|||
if (!bot.music.queue.length) return
|
||||
bot.music.song = bot.music.queue[0]
|
||||
time = Date.now() - startTime
|
||||
bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent()))
|
||||
// bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent()))
|
||||
|
||||
// is spamming commands in core as a self care a good idea?
|
||||
// btw this is totallynotskidded™️ from my song bot except the bossbarName
|
||||
const bossbarName = 'chomens_bot:music' // maybe make this in the config?
|
||||
bot.core.run(`minecraft:bossbar add ${bossbarName} ""`) // is setting the name to "" as a placeholder a good idea?
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} players @a[tag=!nomusic]`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(toComponent())}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`) // should i use purple lol
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} value ${Math.floor(time)}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} max ${bot.music.song.length}`)
|
||||
|
||||
while (bot.music.song?.notes[noteIndex]?.time <= time) {
|
||||
const note = bot.music.song.notes[noteIndex]
|
||||
const floatingPitch = 2 ** ((note.pitch - 12) / 12.0)
|
||||
|
@ -64,6 +76,7 @@ function inject (bot) {
|
|||
}
|
||||
bot.music.queue.shift()
|
||||
if (!bot.music.queue[0]) {
|
||||
bot.core.run(`minecraft:bossbar remove ${bossbarName}`)
|
||||
bot.tellraw('@a', { text: 'Finished playing every song in the queue' })
|
||||
bot.music.stop()
|
||||
return
|
||||
|
@ -130,8 +143,8 @@ function inject (bot) {
|
|||
// { text: '[', color: 'dark_gray' },
|
||||
// { text: 'ChomeNS Bot', color: 'yellow' },
|
||||
// { text: '] ', color: 'dark_gray' },
|
||||
{ text: 'Now Playing', color: 'gold' },
|
||||
{ text: ' | ', color: 'dark_gray' },
|
||||
// { text: 'Now Playing', color: 'gold' },
|
||||
// { text: ' | ', color: 'dark_gray' },
|
||||
{ text: bot.music.song.name, color: 'green' },
|
||||
{ text: ' | ', color: 'dark_gray' },
|
||||
{ text: formatTime(time), color: 'gray' },
|
||||
|
|
Loading…
Reference in a new issue