diff options
Diffstat (limited to 'features/fragBot/index.js')
-rw-r--r-- | features/fragBot/index.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/features/fragBot/index.js b/features/fragBot/index.js index 5662111..c6a2fd9 100644 --- a/features/fragBot/index.js +++ b/features/fragBot/index.js @@ -9,7 +9,7 @@ class FragBot extends Feature { super() } - onEnable(){ + onEnable() { this.initVariables() this.hostingFragBot = false @@ -23,58 +23,58 @@ class FragBot extends Feature { this.registerCommand("fragbot", this.fragbotCommand) - this.registerStep(false, 5, this.step) - this.registerStep(true, 2, this.step2) + this.registerStep(false, 5, this.step).registeredWhen(() => this.hostingFragBot) + this.registerStep(true, 2, this.step2).registeredWhen(() => this.hostingFragBot) this.registerChat("&9&m---------------------------${*}&r&9\n&r${player} &r&ehas invited you to join their party!\n&r&eYou have &r&c60 &r&eseconds to accept. &r&6Click here to join!&r&9\n&r&9&m----------------------------${*}&r", this.recievedPartyInvite) } - - step(){ - if(!this.hostingFragBot) return - if(this.fragBotQueue.length > 0){ + step() { + if (!this.hostingFragBot) return + + if (this.fragBotQueue.length > 0) { let player = this.fragBotQueue.shift() - if(player){ + if (player) { this.commandQueue.push("/party leave") this.commandQueue.push("/party accept " + player) } } } - step2(){ - if(!this.hostingFragBot) return + step2() { + if (!this.hostingFragBot) return - if(this.commandQueue.length > 0){ + if (this.commandQueue.length > 0) { let command = this.commandQueue.shift() - if(command){ + if (command) { ChatLib.say(command) } } } - recievedPartyInvite(player){ - if(!this.hostingFragBot) return + recievedPartyInvite(player) { + if (!this.hostingFragBot) return player = ChatLib.removeFormatting(player).split(" ").pop() this.fragBotQueue.push(player) } - fragbotCommand(...args){ - if(this.hostingFragBot){ + fragbotCommand(...args) { + if (this.hostingFragBot) { this.hostingFragBot = false ChatLib.chat(this.FeatureManager.messagePrefix + "Fragbot has been disabled") - }else{ + } else { this.hostingFragBot = true ChatLib.chat(this.FeatureManager.messagePrefix + "Now acting as a fragbot, run /fragbot again to disable") } } - initVariables(){ + initVariables() { this.hostingFragBot = undefined this.fragBotQueue = undefined this.commandQueue = undefined } - onDisable(){ + onDisable() { this.initVariables() } } |