diff options
-rw-r--r-- | features/mining/index.js | 22 | ||||
-rw-r--r-- | metadata.json | 4 | ||||
-rw-r--r-- | socketConnection.js | 2 |
3 files changed, 19 insertions, 9 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) }) } diff --git a/metadata.json b/metadata.json index 9449f9f..7fd48da 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.85", - "versionId": 212, + "version": "2.1.86", + "versionId": 213, "requires": [ "soopyApis", "soopyAddonsData", diff --git a/socketConnection.js b/socketConnection.js index e8aa796..7cea440 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -227,7 +227,7 @@ class SoopyV2Server extends WebsiteCommunicator { sendCHEventData(event, started) { this.sendData({ - type: "chEvent", + type: "chEvent2", event, started }) |