mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-13 18:34:54 -05:00
chomens_bot_nomusic
This commit is contained in:
parent
41ea92943d
commit
4bf9a0a0ed
1 changed files with 5 additions and 3 deletions
|
@ -43,6 +43,8 @@ function inject (bot) {
|
|||
|
||||
const bossbarName = 'chomens_bot:music' // maybe make this in the config?
|
||||
|
||||
const selector = '@a[tag=!nomusic,tag=!chomens_bot_nomusic]'
|
||||
|
||||
const interval = setInterval(async () => {
|
||||
if (!bot.music.queue.length) return
|
||||
bot.music.song = bot.music.queue[0]
|
||||
|
@ -52,7 +54,7 @@ function inject (bot) {
|
|||
// is spamming commands in core as a self care a good idea?
|
||||
// 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} players ${selector}`)
|
||||
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`)
|
||||
|
@ -62,7 +64,7 @@ function inject (bot) {
|
|||
while (bot.music.song?.notes[noteIndex]?.time <= time) {
|
||||
const note = bot.music.song.notes[noteIndex]
|
||||
const floatingPitch = 2 ** ((note.pitch - 12) / 12.0)
|
||||
bot.core.run(`minecraft:execute as @a[tag=!nomusic] at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
|
||||
bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
|
||||
noteIndex++
|
||||
if (noteIndex >= bot.music.song.notes.length) {
|
||||
if (bot.music.loop === 1) {
|
||||
|
@ -77,7 +79,7 @@ function inject (bot) {
|
|||
}
|
||||
bot.music.queue.shift()
|
||||
if (!bot.music.queue[0]) {
|
||||
bot.tellraw('@a', { text: 'Finished playing every song in the queue' })
|
||||
if (bot.music.queue.length === 0) bot.tellraw('@a', { text: 'Finished playing every song in the queue' })
|
||||
bot.music.stop()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue