summaryrefslogtreecommitdiff
path: root/main.py
blob: 8799d3075da45c7d3f0400c25354579752b9cc79 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
__plugin_name__      = "RedstonerUtils"
__plugin_version__   = "3.0"
__plugin_mainclass__ = "foobar"

import sys
from traceback import format_exc as print_traceback

# damn pythonloader changed the PATH
sys.path += ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7', '/usr/lib/pyshared/python2.7']

try:
  from helpers import *
except:
  print("[RedstonerUtils] ERROR: Failed to import helpers:")
  print(print_traceback())



@hook.enable
def on_enable():
  info("RedstonerUtils enabled!")


@hook.disable
def on_disable():
  shared["modules"]["reports"].stop_reporting()
  info("RedstonerUtils disabled!")


info("Loading RedstonerUtils...")

# Import all modules, in this order
shared["load_modules"] = [
  "misc",
  "adminchat",
  "lagchunks",
  "reports",
  "chatgroups",
  "webtoken",
  "saylol",
  "skullclick",
  "mentio",
  "cycle",
  "motd",
  "abot",
  "forcefield",
  "damnspam",
  "check"
]
shared["modules"] = {}
for module in shared["load_modules"]:
  try:
    shared["modules"][module] = __import__(module)
    info("Module %s loaded." % module)
  except:
    error("Failed to import module %s:" % module)
    error(print_traceback())