add /modules command

lists all modules.
green if loaded, red otherwise
This commit is contained in:
jomo
2014-07-21 02:24:43 +02:00
parent eb287681d1
commit c973025a8e
2 changed files with 10 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ def on_disable():
log("Loading RedstonerUtils...") log("Loading RedstonerUtils...")
# Import all modules, in this order # Import all modules, in this order
load_modules = [ shared["load_modules"] = [
"misc", "misc",
"adminchat", "adminchat",
"lagchunks", "lagchunks",
@@ -46,7 +46,7 @@ load_modules = [
"forcefield" "forcefield"
] ]
shared["modules"] = {} shared["modules"] = {}
for module in load_modules: for module in shared["load_modules"]:
try: try:
shared["modules"][module] = __import__(module) shared["modules"][module] = __import__(module)
log("Module %s loaded." % module) log("Module %s loaded." % module)

View File

@@ -143,3 +143,11 @@ def on_pyeval_command(sender, args):
else: else:
noperm(sender) noperm(sender)
return True return True
@hook.command("modules")
def on_modules_command(sender, args):
plugin_header("Modules")
for mod in shared["load_modules"]:
color = "a" if mod in shared["modules"] else "c"
msg(sender, "&" + color + mod)