diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-06 21:40:49 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-06 21:40:49 +0800 |
commit | f0cfad5af93244618d5a60c88b1c0a4837e629ae (patch) | |
tree | 062a301f34c8e6d3284fa845676b23b2ab8d7f9a /features/fragBot/index.js | |
parent | e2e2d676ee056e9f44f6c67e29f0952b9ef956b2 (diff) | |
download | SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.tar.gz SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.tar.bz2 SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.zip |
+ Many performance improvements
+ Fix rescue mission waypoints
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() } } |