Lint
This commit is contained in:
parent
9847623b25
commit
bfe1111e29
14 changed files with 44 additions and 44 deletions
|
@ -255,8 +255,8 @@ const displayServerList = function (c) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
execute: function (c) {
|
execute: function (c) {
|
||||||
let subcmd;
|
let subcmd
|
||||||
if(c.args.length>=1) subcmd = c.args[0].toLowerCase();
|
if (c.args.length >= 1) subcmd = c.args[0].toLowerCase()
|
||||||
if (subcmd === 'servers') subcmd = 'serverlist'
|
if (subcmd === 'servers') subcmd = 'serverlist'
|
||||||
if (c.cmdName.toLowerCase() === 'serverinfo' || c.cmdName.toLowerCase() === 'specs') subcmd = 'server'
|
if (c.cmdName.toLowerCase() === 'serverinfo' || c.cmdName.toLowerCase() === 'specs') subcmd = 'server'
|
||||||
if (c.cmdName.toLowerCase() === 'serverlist' || c.cmdName.toLowerCase() === 'servers') subcmd = 'serverlist'
|
if (c.cmdName.toLowerCase() === 'serverlist' || c.cmdName.toLowerCase() === 'servers') subcmd = 'serverlist'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const { getMessage } = require('../util/lang.js')
|
const { getMessage } = require('../util/lang.js')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
execute: (c) => {
|
execute: (c) => {
|
||||||
let subcmd;
|
let subcmd
|
||||||
if(c.args.length>=1) subcmd = c.args.splice(0, 1)[0].toLowerCase();
|
if (c.args.length >= 1) subcmd = c.args.splice(0, 1)[0].toLowerCase()
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
case 'add': {
|
case 'add': {
|
||||||
const rate = +(c.args.splice(0, 1)[0])
|
const rate = +(c.args.splice(0, 1)[0])
|
||||||
|
|
|
@ -2,21 +2,21 @@ const index = require('../index.js') // Not used in the code, but may be used by
|
||||||
const { getMessage } = require('../util/lang.js')
|
const { getMessage } = require('../util/lang.js')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
execute: (c) => {
|
execute: (c) => {
|
||||||
const item = eval(c.args.join(' '));
|
const item = eval(c.args.join(' '))
|
||||||
c.reply({
|
c.reply({
|
||||||
translate: '%s: %s',
|
translate: '%s: %s',
|
||||||
color: c.colors.primary,
|
color: c.colors.primary,
|
||||||
with: [
|
with: [
|
||||||
{
|
{
|
||||||
text: getMessage(c.lang, `command.eval.output`),
|
text: getMessage(c.lang, 'command.eval.output'),
|
||||||
color: c.colors.secondary
|
color: c.colors.secondary
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: item + "",
|
text: item + '',
|
||||||
color: c.colors.primary,
|
color: c.colors.primary,
|
||||||
clickEvent: {
|
clickEvent: {
|
||||||
action: 'copy_to_clipboard',
|
action: 'copy_to_clipboard',
|
||||||
value: item + ""
|
value: item + ''
|
||||||
},
|
},
|
||||||
hoverEvent: {
|
hoverEvent: {
|
||||||
action: 'show_text',
|
action: 'show_text',
|
||||||
|
|
|
@ -65,8 +65,8 @@ const printHelp = (c) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const printCmdHelp = (c) => {
|
const printCmdHelp = (c) => {
|
||||||
let cmd;
|
let cmd
|
||||||
if(c.args.length>=1) cmd = c.args[0].toLowerCase();
|
if (c.args.length >= 1) cmd = c.args[0].toLowerCase()
|
||||||
if (!cmds[cmd] || (cmds[cmd].hidden && c.type !== 'console')) {
|
if (!cmds[cmd] || (cmds[cmd].hidden && c.type !== 'console')) {
|
||||||
c.reply({ text: getMessage(c.lang, 'command.help.noCommand') })
|
c.reply({ text: getMessage(c.lang, 'command.help.noCommand') })
|
||||||
return
|
return
|
||||||
|
|
|
@ -17,8 +17,8 @@ module.exports = {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let subcmd;
|
let subcmd
|
||||||
if(c.args.length>=1) subcmd = c.args.splice(0, 1)[0].toLowerCase();
|
if (c.args.length >= 1) subcmd = c.args.splice(0, 1)[0].toLowerCase()
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
case 'set':{
|
case 'set':{
|
||||||
const allowedKeys = ['colorPrimary', 'colorSecondary', 'lang']
|
const allowedKeys = ['colorPrimary', 'colorSecondary', 'lang']
|
||||||
|
|
2
index.js
2
index.js
|
@ -48,7 +48,7 @@ const createBot = function createBot (host, oldId) {
|
||||||
port: host.port ? host.port : 25565,
|
port: host.port ? host.port : 25565,
|
||||||
version: host.version ? host.version : settings.version_mc
|
version: host.version ? host.version : settings.version_mc
|
||||||
}
|
}
|
||||||
if(host.options.online){
|
if (host.options.online) {
|
||||||
options.username = secret.onlineEmail
|
options.username = secret.onlineEmail
|
||||||
options.password = secret.onlinePass
|
options.password = secret.onlinePass
|
||||||
options.auth = 'microsoft'
|
options.auth = 'microsoft'
|
||||||
|
|
|
@ -117,8 +117,8 @@ module.exports = {
|
||||||
|
|
||||||
b._client.on('system_chat', (data) => {
|
b._client.on('system_chat', (data) => {
|
||||||
const json = parse1204(data.content)
|
const json = parse1204(data.content)
|
||||||
if(json.translate == '%s %s › %s'){ // ChipmunkMod format
|
if (json.translate === '%s %s › %s') { // ChipmunkMod format
|
||||||
if(json.with && json.with[1] && json.with[2]){
|
if (json.with && json.with[1] && json.with[2]) {
|
||||||
const username = parsePlain(json.with[1])
|
const username = parsePlain(json.with[1])
|
||||||
const uuid = b.findUUID(username)
|
const uuid = b.findUUID(username)
|
||||||
const nickname = b.findDisplayName(uuid)
|
const nickname = b.findDisplayName(uuid)
|
||||||
|
@ -135,13 +135,13 @@ module.exports = {
|
||||||
b.emit('chat', {
|
b.emit('chat', {
|
||||||
json,
|
json,
|
||||||
type: 'system',
|
type: 'system',
|
||||||
uuid: "00000000-0000-0000-0000-000000000000",
|
uuid: '00000000-0000-0000-0000-000000000000',
|
||||||
message: "",
|
message: '',
|
||||||
nickname: "",
|
nickname: '',
|
||||||
username: ""
|
username: ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if(json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text == ' » '){ // ChipmunkMod format - m_c_player
|
} else if (json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text === ' » ') { // ChipmunkMod format - m_c_player
|
||||||
const username = parsePlain(json.extra[3])
|
const username = parsePlain(json.extra[3])
|
||||||
const uuid = b.findUUID(username)
|
const uuid = b.findUUID(username)
|
||||||
const nickname = b.findDisplayName(uuid)
|
const nickname = b.findDisplayName(uuid)
|
||||||
|
@ -181,19 +181,19 @@ module.exports = {
|
||||||
let username
|
let username
|
||||||
let message
|
let message
|
||||||
let uuid
|
let uuid
|
||||||
if(json.translate == '%s %s › %s'){ // ChipmunkMod format
|
if (json.translate === '%s %s › %s') { // ChipmunkMod format
|
||||||
if(json.with && json.with[1] && json.with[2]){
|
if (json.with && json.with[1] && json.with[2]) {
|
||||||
username = parsePlain(json.with[1])
|
username = parsePlain(json.with[1])
|
||||||
uuid = b.findUUID(username)
|
uuid = b.findUUID(username)
|
||||||
nickname = b.findDisplayName(uuid)
|
nickname = b.findDisplayName(uuid)
|
||||||
message = parsePlain(json.with[2].extra)
|
message = parsePlain(json.with[2].extra)
|
||||||
}
|
}
|
||||||
} else if(json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text == ' » '){ // ChipmunkMod format - m_c_player
|
} else if (json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text === ' » ') { // ChipmunkMod format - m_c_player
|
||||||
username = parsePlain(json.extra[3])
|
username = parsePlain(json.extra[3])
|
||||||
uuid = b.findUUID(username)
|
uuid = b.findUUID(username)
|
||||||
nickname = b.findDisplayName(uuid)
|
nickname = b.findDisplayName(uuid)
|
||||||
message = parsePlain(json.extra[5])
|
message = parsePlain(json.extra[5])
|
||||||
} else if (b.host.options.isVanilla && json.translate === 'chat.type.text') { // Servers without Extras chat
|
} else if (b.host.options.isVanilla && json.translate === 'chat.type.text') { // Servers without Extras chat
|
||||||
if (json.with && json.with.length >= 2) {
|
if (json.with && json.with.length >= 2) {
|
||||||
message = parsePlain(json.with[1])
|
message = parsePlain(json.with[1])
|
||||||
username = parsePlain(json.with[0])
|
username = parsePlain(json.with[0])
|
||||||
|
|
|
@ -37,9 +37,9 @@ module.exports = {
|
||||||
b.lastCmd = Date.now()
|
b.lastCmd = Date.now()
|
||||||
const lang = settings.defaultLang
|
const lang = settings.defaultLang
|
||||||
|
|
||||||
const commandClass = new Command(uuid, name, nickname, text, msgType, prefix, b, userSettings);
|
const commandClass = new Command(uuid, name, nickname, text, msgType, prefix, b, userSettings)
|
||||||
b.emit("command",commandClass)
|
b.emit('command', commandClass)
|
||||||
if(commandClass.cancel === true) return
|
if (commandClass.cancel === true) return
|
||||||
|
|
||||||
if (cmds[commandClass.cmdName.toLowerCase()]) {
|
if (cmds[commandClass.cmdName.toLowerCase()]) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
||||||
b.refillCoreCmd = `/fill ~ 55 ~ ~${cs.x - 1} ${54 + cs.y} ~${cs.z - 1} command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`
|
b.refillCoreCmd = `/fill ~ 55 ~ ~${cs.x - 1} ${54 + cs.y} ~${cs.z - 1} command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`
|
||||||
|
|
||||||
b.advanceccq = function () {
|
b.advanceccq = function () {
|
||||||
if(b.host.options.useChat) return
|
if (b.host.options.useChat) return
|
||||||
if (b.ccq[0] && b.ccq[0].length !== 0) {
|
if (b.ccq[0] && b.ccq[0].length !== 0) {
|
||||||
b._client.write('update_command_block', {
|
b._client.write('update_command_block', {
|
||||||
command: '/',
|
command: '/',
|
||||||
|
@ -66,7 +66,7 @@ module.exports = {
|
||||||
skinParts: 127, // Allow the second layer of the skin, when the bot is sudoed to do /skin
|
skinParts: 127, // Allow the second layer of the skin, when the bot is sudoed to do /skin
|
||||||
mainHand: 1 // Right hand
|
mainHand: 1 // Right hand
|
||||||
})
|
})
|
||||||
if (!b.host.options.useChat){
|
if (!b.host.options.useChat) {
|
||||||
b.add_sc_task('cc', () => {
|
b.add_sc_task('cc', () => {
|
||||||
b.chat(b.refillCoreCmd)
|
b.chat(b.refillCoreCmd)
|
||||||
}, true)
|
}, true)
|
||||||
|
@ -112,9 +112,9 @@ module.exports = {
|
||||||
|
|
||||||
b.tellraw = (uuid, message) => {
|
b.tellraw = (uuid, message) => {
|
||||||
let finalname = ''
|
let finalname = ''
|
||||||
if(b.host.options.useChat){
|
if (b.host.options.useChat) {
|
||||||
if(b.host.options.useAmpersandColorCodes){
|
if (b.host.options.useAmpersandColorCodes) {
|
||||||
b.chat(mcParser(message).replaceAll("§", "&"))
|
b.chat(mcParser(message).replaceAll('§', '&'))
|
||||||
} else {
|
} else {
|
||||||
b.chat(plainParser(message))
|
b.chat(plainParser(message))
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ const hashcheck = require('../util/hashcheck.js')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
load: (b) => {
|
load: (b) => {
|
||||||
b.on("command", c => {
|
b.on('command', c => {
|
||||||
const cmd = c.command.split(' ')
|
const cmd = c.command.split(' ')
|
||||||
const command = cmds[c.cmdName.toLowerCase()]
|
const command = cmds[c.cmdName.toLowerCase()]
|
||||||
const verify = hashcheck(cmd, c.uuid)
|
const verify = hashcheck(cmd, c.uuid)
|
||||||
|
@ -24,7 +24,7 @@ module.exports = {
|
||||||
c.cancel = true
|
c.cancel = true
|
||||||
} else if (verify > 0) {
|
} else if (verify > 0) {
|
||||||
c.rewriteCommand(cmd.slice(0, cmd.length - 1).join(' '))
|
c.rewriteCommand(cmd.slice(0, cmd.length - 1).join(' '))
|
||||||
c.verify = verify;
|
c.verify = verify
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Command {
|
||||||
this.port = bot.host.port
|
this.port = bot.host.port
|
||||||
this.serverName = bot.host.options.name
|
this.serverName = bot.host.options.name
|
||||||
this.prefs = prefs
|
this.prefs = prefs
|
||||||
this.cancel = false;
|
this.cancel = false
|
||||||
if (prefs.lang) {
|
if (prefs.lang) {
|
||||||
this.lang = prefs.lang
|
this.lang = prefs.lang
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const index = require('../index.js')
|
const index = require('../index.js')
|
||||||
const parse = require('../util/chatparse_console.js')
|
const parse = require('../util/chatparse_console.js')
|
||||||
const settings = require('../settings.json')
|
const settings = require('../settings.json')
|
||||||
const version = require("../version.json")
|
const version = require('../version.json')
|
||||||
class ConsoleCommand {
|
class ConsoleCommand {
|
||||||
constructor (cmd, index2) {
|
constructor (cmd, index2) {
|
||||||
this.send = () => {}
|
this.send = () => {}
|
||||||
|
@ -22,7 +22,7 @@ class ConsoleCommand {
|
||||||
this.host = ''
|
this.host = ''
|
||||||
this.port = '3'
|
this.port = '3'
|
||||||
this.serverName = `${version.botName} Console`
|
this.serverName = `${version.botName} Console`
|
||||||
this.cancel = false;
|
this.cancel = false
|
||||||
this.lang = settings.defaultLang
|
this.lang = settings.defaultLang
|
||||||
this.colors = settings.colors
|
this.colors = settings.colors
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const mcd=require("minecraft-data")
|
const mcd = require('minecraft-data')
|
||||||
module.exports = function (ver) {
|
module.exports = function (ver) {
|
||||||
return mcd.versionsByMinecraftVersion.pc[ver].version
|
return mcd.versionsByMinecraftVersion.pc[ver].version
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
module.exports = function (bytes) {
|
module.exports = function (bytes) {
|
||||||
if(bytes >= 1125899906842624){ // Petabytes
|
if (bytes >= 1125899906842624) { // Petabytes
|
||||||
return `${Math.round(bytes / 1125899906842624 * 100) / 100} PB`
|
return `${Math.round(bytes / 1125899906842624 * 100) / 100} PB`
|
||||||
} else if(bytes >= 1099511627776){ // Terabytes
|
} else if (bytes >= 1099511627776) { // Terabytes
|
||||||
return `${Math.round(bytes / 1099511627776 * 100) / 100} TB`
|
return `${Math.round(bytes / 1099511627776 * 100) / 100} TB`
|
||||||
} else if(bytes >= 1073741824){ // Gigabytes
|
} else if (bytes >= 1073741824) { // Gigabytes
|
||||||
return `${Math.round(bytes / 1073741824 * 100) / 100} GB`
|
return `${Math.round(bytes / 1073741824 * 100) / 100} GB`
|
||||||
} else if(bytes >= 1048576){ // Megabytes
|
} else if (bytes >= 1048576) { // Megabytes
|
||||||
return `${Math.round(bytes / 1048576 * 100) / 100} MB`
|
return `${Math.round(bytes / 1048576 * 100) / 100} MB`
|
||||||
} else if(bytes >= 1024){ // Kilobytes
|
} else if (bytes >= 1024) { // Kilobytes
|
||||||
return `${Math.round(bytes / 1024 * 100) / 100} KB`
|
return `${Math.round(bytes / 1024 * 100) / 100} KB`
|
||||||
} else { // Bytes
|
} else { // Bytes
|
||||||
return `${bytes} B`
|
return `${bytes} B`
|
||||||
|
|
Loading…
Reference in a new issue