This commit is contained in:
ChomeNS 2023-01-02 13:13:47 +07:00
parent f843316c60
commit fb53177b39

View file

@ -41,6 +41,8 @@ function inject (bot) {
resetTime()
}
const bossbarName = 'chomens_bot:music' // maybe make this in the config?
const interval = setInterval(async () => {
if (!bot.music.queue.length) return
bot.music.song = bot.music.queue[0]
@ -48,8 +50,7 @@ function inject (bot) {
// 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?
// btw this is totallynotskidded™ from my song bot except the bossbarName (above)
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())}`)
@ -76,7 +77,6 @@ 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,6 +130,7 @@ function inject (bot) {
time = 0
startTime = Date.now()
noteIndex = 0
bot.core.run(`minecraft:bossbar remove ${bossbarName}`) // maybe not a good place to put it here but idk
}
function formatTime (time) {