2023-12-17 14:55:27 -05:00
|
|
|
const convert = require('color-convert')
|
|
|
|
|
2024-01-12 12:24:01 -05:00
|
|
|
function bruhify (bot) {
|
2023-12-17 14:55:27 -05:00
|
|
|
bot.bruhifyText = ''
|
|
|
|
let startHue = 0
|
2024-01-26 21:24:08 -05:00
|
|
|
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
|
|
|
const timer = setInterval(() => {
|
2023-12-17 14:55:27 -05:00
|
|
|
if (bot.bruhifyText === '') return
|
|
|
|
let tag = 'bruhify'
|
|
|
|
let hue = startHue
|
|
|
|
const displayName = bot.bruhifyText
|
|
|
|
const increment = (360 / Math.max(displayName.length, 20))
|
|
|
|
const component = []
|
|
|
|
for (const character of displayName) {
|
|
|
|
const color = convert.hsv.hex(hue, 100, 100)
|
|
|
|
component.push({ text: character, color: `#${color}` })
|
|
|
|
hue = (hue + increment) % 360
|
|
|
|
}
|
2024-01-26 21:24:08 -05:00
|
|
|
if (!bot.options.Core.CorelessMode){
|
|
|
|
bot.chat(ChatMessage.fromNotch(component).toMotd().replaceAll('§', '&'))
|
|
|
|
startHue = (startHue + increment) % 360
|
|
|
|
}else{
|
2023-12-17 14:55:27 -05:00
|
|
|
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`)
|
|
|
|
|
|
|
|
startHue = (startHue + increment) % 360
|
2024-01-26 21:24:08 -05:00
|
|
|
}
|
|
|
|
}, 100)
|
2023-12-17 14:55:27 -05:00
|
|
|
|
|
|
|
bot.on('end', () => {
|
|
|
|
// clearInterval(timer)
|
|
|
|
})
|
|
|
|
}
|
2024-01-12 12:24:01 -05:00
|
|
|
module.exports = bruhify
|