summaryrefslogtreecommitdiff
path: root/cycle.py
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2014-07-27 19:42:33 +0200
committerjomo <github@jomo.tv>2014-07-27 19:42:33 +0200
commitb1a3a92e49b353dfa42b52b448cdbc3b27bb33f8 (patch)
tree1b135af4f422d2ebcb96e814c08923d52b2f85c3 /cycle.py
parente9b0ad656b71841fa23f332ddf8eff43e5cf1986 (diff)
apply file read/save helpers
Diffstat (limited to 'cycle.py')
-rw-r--r--cycle.py15
1 files changed, 2 insertions, 13 deletions
diff --git a/cycle.py b/cycle.py
index 7795f23..8460a0f 100644
--- a/cycle.py
+++ b/cycle.py
@@ -1,12 +1,6 @@
-import json
from helpers import *
-cyclers_file = "plugins/redstoner-utils.py.dir/files/cycle.json"
-no_cyclers = [] # opt-out
-try:
- no_cyclers = json.loads(open(cyclers_file).read())
-except Exception, e:
- error("Failed to load no_cyclers: %s" % e)
+no_cyclers = open_json_file("cycle", [])
@hook.command("cycle")
@@ -73,9 +67,4 @@ def do_cycle(player, down):
inv.setContents(items)
def save_cyclers():
- try:
- chatgroups_file = open(cyclers_file, "w")
- chatgroups_file.write(json.dumps(no_cyclers))
- chatgroups_file.close()
- except Exception, e:
- error("Failed to write reports: " + str(e)) \ No newline at end of file
+ save_json_file("cycle", no_cyclers) \ No newline at end of file