mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
e
This commit is contained in:
parent
92cc8366fd
commit
a40c8a0cd5
1 changed files with 22 additions and 18 deletions
|
@ -1,22 +1,26 @@
|
||||||
const convert = require('color-convert');
|
const convert = require('color-convert')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inject: function(bot) {
|
inject: function (bot) {
|
||||||
bot.bruhifyText = '';
|
bot.bruhifyText = ''
|
||||||
let startHue = 0;
|
let startHue = 0
|
||||||
timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
if (bot.bruhifyText === '') return;
|
if (bot.bruhifyText === '') return
|
||||||
|
|
||||||
let hue = startHue;
|
let hue = startHue
|
||||||
const displayName = bot.bruhifyText;
|
const displayName = bot.bruhifyText
|
||||||
const increment = (360 / Math.max(displayName.length, 20));
|
const increment = (360 / Math.max(displayName.length, 20))
|
||||||
const component = [];
|
const component = []
|
||||||
for (const character of displayName) {
|
for (const character of displayName) {
|
||||||
const color = convert.hsv.hex(hue, 100, 100);
|
const color = convert.hsv.hex(hue, 100, 100)
|
||||||
component.push({text: character, color: `#${color}`});
|
component.push({ text: character, color: `#${color}` })
|
||||||
hue = (hue + increment) % 360;
|
hue = (hue + increment) % 360
|
||||||
}
|
}
|
||||||
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`);
|
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`)
|
||||||
startHue = (startHue + increment) % 360;
|
startHue = (startHue + increment) % 360
|
||||||
}, 100);
|
}, 100)
|
||||||
},
|
|
||||||
};
|
bot.on('end', () => {
|
||||||
|
clearInterval(timer)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue