diff --git a/changelog.json b/changelog.json index 40087b8..80aacf8 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,6 @@ [ "Remove pig and cow command", "*entity now uses minecraft-data", - "*cowsay cow support" + "*cowsay cow support", + "*cowsay list" ] \ No newline at end of file diff --git a/commands/cowsay.js b/commands/cowsay.js index 0e84712..787549d 100644 --- a/commands/cowsay.js +++ b/commands/cowsay.js @@ -5,9 +5,24 @@ module.exports = { name: 'cowsay', alias: [], description: 'Moo', - usage: ' ', + usage: ' ', trusted: 0, execute: function(bot, username, usernameraw, sender, prefix, args) { - bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`})); + if (args[0]!=='list') { + bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`})); + } else { + let color = '§6'; + let message = ''; + + Object.keys(cows).forEach((value) => { + if (color==='§6') { + color = '§e'; + } else if (color==='§e') { + color = '§6'; + }; + message += color + value + ' '; + }); + bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Cows: ', color: 'green'}, '\n', {text: message, color: 'red'}])); + } }, };