summaryrefslogtreecommitdiff
path: root/lagchunks.py
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2014-07-16 00:33:43 +0200
committerjomo <github@jomo.tv>2014-07-16 00:33:43 +0200
commit1430a454ed18ac3a815cc4d39c7dffd2e6ac9e90 (patch)
tree493cbf18f33d635e7b3123438d8857f8544726c2 /lagchunks.py
parentd2ec8b6d3f2d0804dbf52e7931cb589e9b323acd (diff)
removed camelcase, added more coding style to readme
Diffstat (limited to 'lagchunks.py')
-rw-r--r--lagchunks.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/lagchunks.py b/lagchunks.py
index 4bec197..db45aa3 100644
--- a/lagchunks.py
+++ b/lagchunks.py
@@ -4,12 +4,14 @@ from helpers import *
lagchunks = []
-def printHelp(sender):
+
+def print_help(sender):
msg(sender, " &b/lagchunks <amount> &eList chunks where #entities >= <amount>")
msg(sender, " &b/lagchunks list &eShow list again")
msg(sender, " &b/lagchunks tp <num> &eTeleport to chunk <num> from list")
-def scanChunks(amount):
+
+def scan_chunks(amount):
try:
global lagchunks
chunks = []
@@ -24,37 +26,39 @@ def scanChunks(amount):
except Exception, e:
error(e)
-def listChunks(sender):
+
+def list_chunks(sender):
for id, chunk in enumerate(lagchunks):
msg(sender, "&b%s&a: (&b%s&a) %s&7, &a%s &7(%s)" % (id, chunk[4], chunk[1], chunk[3], chunk[0].getName()))
msg(sender, "&2------------------")
-def tpChunk(sender, id):
+def tp_chunk(sender, id):
chunk = lagchunks[id]
safetp(sender, chunk[0], chunk[1], chunk[2], chunk[3])
msg(sender, "&aTeleported to &b%s&a, &b%s&a in &7%s&a with &b%s&a entities nearby." % (chunk[1], chunk[3], chunk[0].getName(), chunk[4]))
+
@hook.command("lagchunks")
-def onLagchunksCommand(sender, args):
+def on_lagchunks_command(sender, args):
try:
if sender.hasPermission("utils.lagchunks"):
- plugHeader(sender, "Lagchunks")
+ plugin_header(sender, "Lagchunks")
global lagchunks
if len(args) == 1 and args[0].isdigit() and int(args[0]) > 0:
amount = args[0]
msg(sender, "&aChunks with at least &b%s &aentities:" % amount, )
- scanChunks(int(amount))
- listChunks(sender)
+ scan_chunks(int(amount))
+ list_chunks(sender)
elif len(args) == 1 and args[0].lower() == "list":
- listChunks(sender)
+ list_chunks(sender)
elif len(args) == 2 and args[0].lower() == "tp" and args[1].isdigit() and int(args[1]) <= len(lagchunks)-1:
if isinstance(sender, Player):
- tpChunk(sender, int(args[1]))
+ tp_chunk(sender, int(args[1]))
else:
msg(sender, "&cOnly players can do this!")
else:
- printHelp(sender)
+ print_help(sender)
else:
noperm(sender)
return True