From f9085b19e0bc3d4bc28fc13a5603a31a91ee7c20 Mon Sep 17 00:00:00 2001
From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com>
Date: Wed, 17 Nov 2021 17:07:49 +0800
Subject: - unload all modules on game unload event - make all chatlib chats
use soopyv2 prefix
---
featureClass/class.js | 2 +-
featureClass/featureManager.js | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
(limited to 'featureClass')
diff --git a/featureClass/class.js b/featureClass/class.js
index 11b3492..c9977d8 100644
--- a/featureClass/class.js
+++ b/featureClass/class.js
@@ -124,7 +124,7 @@ class Feature {
if(this.FeatureManager.commandFuncs[name]){
this.FeatureManager.commandFuncs[name].call(this, ...(args || []))
}else{
- ChatLib.chat("&cThis command is not available atm")
+ ChatLib.chat(this.FeatureManager.messagePrefix + "This command is not available atm")
}
}, this)
}
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js
index 5287a6f..0d9101b 100644
--- a/featureClass/featureManager.js
+++ b/featureClass/featureManager.js
@@ -1,11 +1,9 @@
///
///
-import LocationSetting from "../features/settings/settingThings/location";
import logger from "../logger";
const File = Java.type("java.io.File")
import metadata from "../metadata.js"
import { registerForge as registerForgeBase, unregisterForge as unregisterForgeBase} from "./forgeEvents.js"
-import soopyV2Server from "../socketConnection"
class FeatureManager {
constructor(){
@@ -60,6 +58,7 @@ class FeatureManager {
this.registerEvent("worldUnload", this.saveFeatureSettings, this)
this.registerEvent("gameUnload", this.saveFeatureSettings, this)
+ this.registerEvent("gameUnload", this.unloadAllFeatures, this)
this.registerCommand("soopyunloadfeature", (args)=>{
new Thread(()=>{
@@ -376,6 +375,12 @@ class FeatureManager {
return this
}
+ unloadAllFeatures(){
+ Object.keys(this.features).forEach((feature)=>{
+ this.unloadFeature(feature)
+ })
+ }
+
isFeatureLoaded(feature){
return !!this.features[feature]
}
--
cgit