diff options
author | jomo <github@jomo.tv> | 2014-07-27 19:42:33 +0200 |
---|---|---|
committer | jomo <github@jomo.tv> | 2014-07-27 19:42:33 +0200 |
commit | b1a3a92e49b353dfa42b52b448cdbc3b27bb33f8 (patch) | |
tree | 1b135af4f422d2ebcb96e814c08923d52b2f85c3 /cycle.py | |
parent | e9b0ad656b71841fa23f332ddf8eff43e5cf1986 (diff) |
apply file read/save helpers
Diffstat (limited to 'cycle.py')
-rw-r--r-- | cycle.py | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -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 |