diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-24 20:13:39 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-24 20:13:39 +0800 |
commit | 7d40a943f3148979f0572e17d2a4f6a7c49beeb7 (patch) | |
tree | 4096838520d96c9ab91b6c900a82db64710c88c7 /features/mining/index.js | |
parent | 062f87c1acca16a40c8944de27efaac9741b44e6 (diff) | |
download | SoopyV2-7d40a943f3148979f0572e17d2a4f6a7c49beeb7.tar.gz SoopyV2-7d40a943f3148979f0572e17d2a4f6a7c49beeb7.tar.bz2 SoopyV2-7d40a943f3148979f0572e17d2a4f6a7c49beeb7.zip |
+ fix showing dwarven mines events on crystal hollows events thingo (oops)
Diffstat (limited to 'features/mining/index.js')
-rw-r--r-- | features/mining/index.js | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/features/mining/index.js b/features/mining/index.js index eb1c434..b8eb9c9 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -16,6 +16,11 @@ class Mining extends Feature { super() } + isInCH() { + if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false + return this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows" + } + onEnable() { this.initVariables() @@ -142,17 +147,22 @@ class Mining extends Feature { this.nextChEventElement.setText("&6Event&7> &f" + socketConnection.chEvent.join(" &7->&f ")) }) - // 2X POWDER ENDED! - // Passive Active Event - // 2X POWDER STARTED! - //&r&r&r &r&9&lGONE WITH THE WIND ENDED!&r - //§r§r§r §r§b§l2X POWDER ENDED!§r - //§r§r§r §r§b§l2X POWDER STARTED!§r + let lastWorldChange = 0 + + this.registerEvent("worldLoad", () => { + lastWorldChange = Date.now() + }) this.registerChat("&r&r&r ${spaces}&r&${color}&l${event} ENDED!&r", (spaces, color, event) => { + if (Date.now() - lastWorldChange < 5000) return + if (!this.isInCH()) return + socketConnection.sendCHEventData(event.trim(), false) }) this.registerChat("&r&r&r ${spaces}&r&${color}&l${event} STARTED!&r", (spaces, color, event) => { + if (Date.now() - lastWorldChange < 5000) return + if (!this.isInCH()) return + socketConnection.sendCHEventData(event.trim(), true) }) } |