diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-11-11 15:30:20 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-11-11 15:30:20 +0800 |
commit | 9e7bedbd8bedd5599a756cce9cad76754f9a2e74 (patch) | |
tree | e78d23b5e52859c029118d647511345a8fb0d1e2 /class.js | |
parent | cd85af68f5af559d869097306cf063a628b19f6f (diff) | |
download | SoopyV2-9e7bedbd8bedd5599a756cce9cad76754f9a2e74.tar.gz SoopyV2-9e7bedbd8bedd5599a756cce9cad76754f9a2e74.tar.bz2 SoopyV2-9e7bedbd8bedd5599a756cce9cad76754f9a2e74.zip |
Fixes to many things
Diffstat (limited to 'class.js')
-rw-r--r-- | class.js | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/class.js b/class.js deleted file mode 100644 index 1cfdd8b..0000000 --- a/class.js +++ /dev/null @@ -1,139 +0,0 @@ -/// <reference types="../../CTAutocomplete" /> - -import logger from "../logger" - -/// <reference lib="es2015" /> - -class Feature { - constructor(){ - this.FeatureManager = undefined - this.events = {} - this.customEvents = {} - this.forgeEvents = {} - this.soopyEvents = {} - - this.id = undefined - - this.enabled = false - } - - setId(id){ - this.id = id - } - getId(){ - return this.id - } - - _onDisable(){ - Object.values(this.events).forEach(e=>this.FeatureManager.unregisterEvent(e)) //calling parent unregister to avoid the set in unregister event - Object.values(this.customEvents).forEach(e=>this.FeatureManager.unregisterCustom(e)) //calling parent unregister to avoid the set in unregister event - - this.onDisable() - - this.events = {} - this.customEvents = {} - this.enabled = false - } - - _onEnable(parent){ - this.FeatureManager = parent - - this.enabled = true - - this.onEnable() - } - - onDisable(){} - onEnable(){} - - registerEvent(event, func){ - let theEvent = this.FeatureManager.registerEvent(event, func, this) - - this.events[theEvent.id] = theEvent - - return theEvent - } - - unregisterEvent(event){ - this.FeatureManager.unregisterEvent(event) - - delete this.events[event.id] - } - registerSoopy(event, func){ - let theEvent = this.FeatureManager.registerSoopy(event, func, this) - - this.soopyEvents[theEvent.id] = theEvent - - return theEvent - } - - unregisterSoopy(event){ - this.FeatureManager.unregisterSoopy(event) - - delete this.soopyEvents[event.id] - } - - registerForge(event, func){ - let theEvent = this.FeatureManager.registerForge(event, func, this) - - this.forgeEvents[theEvent.id] = theEvent - - return theEvent - } - - unregisterForge(event){ - this.FeatureManager.unregisterForge(event) - - delete this.forgeEvents[event.id] - } - - registerChat(criteria, func){ - let theEvent = this.FeatureManager.registerChat(criteria, func, this) - - this.customEvents[theEvent.id] = theEvent - - return theEvent - } - registerStep(isFps, interval, func){ - let theEvent = this.FeatureManager.registerStep(isFps, interval, func, this) - - this.customEvents[theEvent.id] = theEvent - - return theEvent - } - - registerCustom(event, func){ - let theEvent = this.FeatureManager.registerCustom(event, func, this) - - this.customEvents[theEvent.id] = theEvent - - return theEvent - } - - registerCommand(name, func){ - this.FeatureManager.commandFuncs[name] = func - - this.FeatureManager.registerCommand(name, (...args)=>{ - if(this.FeatureManager.commandFuncs[name]){ - this.FeatureManager.commandFuncs[name].call(this, ...(args || [])) - }else{ - ChatLib.chat("&cThis command is not available atm") - } - }, this) - } - unregisterCommand(name){ - delete this.FeatureManager.commandFuncs[name] - } - - unregisterCustom(event){ - this.FeatureManager.unregisterCustom(event) - - delete this.customEvents[event.id] - } - - createCustomEvent(eventId){ - return this.FeatureManager.createCustomEvent(eventId) - } -} - -export default Feature
\ No newline at end of file |