-
Notifications
You must be signed in to change notification settings - Fork 2
/
plugin.py
40 lines (27 loc) · 874 Bytes
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from os import path
from config import ConfigManager
class Omneity(PythonPlugin):
default_config = {
'modules': [
'aliases',
'actionsigns'
]
}
def onEnable(self):
# Config stuffs
self.getDataFolder().mkdirs()
self.config_manager = ConfigManager(path.join(self.getDataFolder().getAbsolutePath(), 'config.yml'), default=self.default_config)
self.config_manager.load_config()
# Register listeners
self.listeners = list()
for module_name in self.config_manager.config['modules']:
listener = __import__(module_name).listener(self)
self.listeners.append(listener)
listener.onEnable()
self.getServer().getPluginManager().registerEvents(listener, self);
print "Omneity Enabled"
def onDisable(self):
for listener in self.listeners:
listener.onDisable()
self.config_manager.save_config()
print "Omneity Disabled"