remove trailing whitespace, replace tabs with 4x space
This commit is contained in:
12
adminchat.py
12
adminchat.py
@@ -50,12 +50,12 @@ def get_key(uuid):
|
||||
key = ac_keys.get(uuid)
|
||||
return key if key != None else ac_defaultkey
|
||||
|
||||
@simplecommand("adminchatkey",
|
||||
aliases = ["ackey"],
|
||||
senderLimit = 0,
|
||||
helpNoargs = True,
|
||||
helpSubcmd = True,
|
||||
description = "Sets a key character for adminchat",
|
||||
@simplecommand("adminchatkey",
|
||||
aliases = ["ackey"],
|
||||
senderLimit = 0,
|
||||
helpNoargs = True,
|
||||
helpSubcmd = True,
|
||||
description = "Sets a key character for adminchat",
|
||||
usage = "<key>")
|
||||
def adminchatkey_command(sender, command, label, args):
|
||||
key = " ".join(args)
|
||||
|
||||
@@ -92,7 +92,7 @@ def adminnotes_command(sender, command, label, args):
|
||||
show_an_help(sender)
|
||||
return
|
||||
if not args[1].isdigit():
|
||||
msg(sender, "&cThe ID has to be numeric (check /an if you're unsure)")
|
||||
msg(sender, "&cThe ID has to be numeric (check /an if you're unsure)")
|
||||
return
|
||||
note_id = int(args[1])-1
|
||||
if note_id >= len(notes):
|
||||
|
||||
@@ -20,13 +20,13 @@ def helpMsg(sender, cmd, description, usage, aliases, permission):
|
||||
|
||||
|
||||
def simplecommand(cmd,
|
||||
aliases = [],
|
||||
usage = "[args...]",
|
||||
aliases = [],
|
||||
usage = "[args...]",
|
||||
description = None,
|
||||
senderLimit = -1,
|
||||
amin = 0,
|
||||
amax = -1,
|
||||
helpNoargs = False,
|
||||
senderLimit = -1,
|
||||
amin = 0,
|
||||
amax = -1,
|
||||
helpNoargs = False,
|
||||
helpSubcmd = False):
|
||||
cmd = cmd.lower()
|
||||
permission = "utils." + cmd
|
||||
@@ -107,4 +107,4 @@ class Validate():
|
||||
if not checkargs(sender, args, amin, amax):
|
||||
raise CommandException("")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ settingInformation = dict( #[setting type, identifying description, detailed des
|
||||
)
|
||||
|
||||
defaults = {
|
||||
0: list,
|
||||
0: list,
|
||||
1: dict,
|
||||
2: list
|
||||
}
|
||||
@@ -87,8 +87,8 @@ def getSettingDetails(arg):
|
||||
raise CommandException(" &cThat setting could not be found.\n For command help, use &o/toggle &cor &o/set")
|
||||
|
||||
@simplecommand("toggle",
|
||||
aliases = ["setting", "set", "config"],
|
||||
usage = "<setting> [value|info]",
|
||||
aliases = ["setting", "set", "config"],
|
||||
usage = "<setting> [value|info]",
|
||||
description = "Toggles or sets your preferences for our redstone \nutilities. The following settings are available:\n" + ", ".join([x for x in settingInformation]),
|
||||
senderLimit = 0,
|
||||
helpNoargs = True,
|
||||
@@ -144,13 +144,13 @@ def toggle_command(sender, command, label, args):
|
||||
if arg2 == "details":
|
||||
return " &aSetting %s:\n &9%s \n&6Accepted arguments: [<slot>|clear|details]" % (setting, details[2])
|
||||
|
||||
slot = int(arg2) if arg2.isdigit() else 0
|
||||
slot = int(arg2) if arg2.isdigit() else 0
|
||||
if not (0 <= slot <= details[4]):
|
||||
return " &cSlot number must be more than or equal to 0 and less than or equal to %s!" % details[4]
|
||||
|
||||
item = fromStack(player.getItemInHand())
|
||||
if item[0] == 0 or item[1] <= 0:
|
||||
if enabled:
|
||||
if enabled:
|
||||
items = values[uuid]
|
||||
if slot in items:
|
||||
del items[slot]
|
||||
@@ -197,16 +197,16 @@ def on_block_place(event):
|
||||
material = block.getType()
|
||||
|
||||
|
||||
if (material in (Material.WOOD_STEP, Material.STEP)
|
||||
and isEnabled("slab", uuid)
|
||||
and player.hasPermission("utils.toggle.slab")
|
||||
if (material in (Material.WOOD_STEP, Material.STEP)
|
||||
and isEnabled("slab", uuid)
|
||||
and player.hasPermission("utils.toggle.slab")
|
||||
and block.getData() < 8
|
||||
):
|
||||
block.setData(block.getData() + 8) # Flip upside down
|
||||
|
||||
|
||||
elif (material == Material.CAULDRON
|
||||
and isEnabled("cauldron", uuid)
|
||||
elif (material == Material.CAULDRON
|
||||
and isEnabled("cauldron", uuid)
|
||||
and player.hasPermission("utils.toggle.cauldron")
|
||||
):
|
||||
block.setData(3) #3 layers of water, 3 signal strength
|
||||
@@ -214,7 +214,7 @@ def on_block_place(event):
|
||||
|
||||
elif ((material == Material.FURNACE and player.hasPermission("utils.toggle.furnace"))
|
||||
or (material == Material.DROPPER and player.hasPermission("utils.toggle.dropper"))
|
||||
or (material == Material.HOPPER and player.hasPermission("utils.toggle.hopper"))
|
||||
or (material == Material.HOPPER and player.hasPermission("utils.toggle.hopper"))
|
||||
):
|
||||
stacks = get(str(material).lower()).get(uuid)
|
||||
if stacks != None: # Enabled
|
||||
@@ -227,7 +227,7 @@ def on_block_place(event):
|
||||
"""
|
||||
elif (material == Material.REDSTONE_TORCH_ON
|
||||
and event.getBlockAgainst().getType() == Material.REDSTONE_BLOCK
|
||||
and isEnabled("torch", uuid)
|
||||
and isEnabled("torch", uuid)
|
||||
and player.hasPermission("utils.toggle.torch")
|
||||
):
|
||||
torches_to_break.append(block)
|
||||
@@ -244,8 +244,8 @@ def on_block_place(event):
|
||||
@hook.event("player.PlayerInteractEvent", "monitor")
|
||||
def on_interact(event):
|
||||
player = event.getPlayer()
|
||||
if (isEnabled("cauldron", uid(player))
|
||||
and player.hasPermission("utils.toggle.cauldron")
|
||||
if (isEnabled("cauldron", uid(player))
|
||||
and player.hasPermission("utils.toggle.cauldron")
|
||||
and is_creative(player)
|
||||
and event.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||
and (not event.hasItem() or event.getItem().getType() == Material.REDSTONE)
|
||||
@@ -269,7 +269,7 @@ def stop_breaking_torches():
|
||||
class torch_breaker(Runnable):
|
||||
|
||||
def run():
|
||||
|
||||
|
||||
try:
|
||||
if break_torches:
|
||||
for i in range(len(torches_to_break)):
|
||||
|
||||
@@ -97,12 +97,12 @@ def on_chat(event):
|
||||
groupchat(sender, msge)
|
||||
event.setCancelled(True)
|
||||
|
||||
@simplecommand("chatgroupkey",
|
||||
aliases = ["cgkey"],
|
||||
senderLimit = 0,
|
||||
helpNoargs = True,
|
||||
helpSubcmd = True,
|
||||
description = "Sets a key character for chatting to your chatgroup",
|
||||
@simplecommand("chatgroupkey",
|
||||
aliases = ["cgkey"],
|
||||
senderLimit = 0,
|
||||
helpNoargs = True,
|
||||
helpSubcmd = True,
|
||||
description = "Sets a key character for chatting to your chatgroup",
|
||||
usage = "<key>")
|
||||
def chatgroupkey_command(sender, command, label, args):
|
||||
key = " ".join(args)
|
||||
|
||||
@@ -126,7 +126,7 @@ def runas(player, cmd):
|
||||
player.chat("/" + cmd)
|
||||
else:
|
||||
server.dispatchCommand(player, cmd)
|
||||
|
||||
|
||||
|
||||
def is_player(obj):
|
||||
"""
|
||||
|
||||
@@ -34,10 +34,10 @@ def matches_thread(password, user):
|
||||
|
||||
|
||||
@simplecommand("cgpass",
|
||||
usage = "<password> <new password>",
|
||||
description = "Changes your password",
|
||||
senderLimit = 0,
|
||||
helpNoargs = True)
|
||||
usage = "<password> <new password>",
|
||||
description = "Changes your password",
|
||||
senderLimit = 0,
|
||||
helpNoargs = True)
|
||||
def change_pass_command(sender, command, label, args):
|
||||
if sender.getName() in logging_in:
|
||||
return "&cYou are not logged in"
|
||||
@@ -52,9 +52,9 @@ def change_pass_command(sender, command, label, args):
|
||||
return "&cYou are not registered"
|
||||
|
||||
@simplecommand("login",
|
||||
usage = "<password>",
|
||||
usage = "<password>",
|
||||
description = "Logs you in if <password> matches your password.",
|
||||
senderLimit = 0,
|
||||
senderLimit = 0,
|
||||
helpNoargs = True)
|
||||
def login_command(sender, command, label, args):
|
||||
password = args[0]
|
||||
@@ -195,7 +195,7 @@ def kick_thread():
|
||||
if name in logging_in:
|
||||
del logging_in[name]
|
||||
break
|
||||
|
||||
|
||||
|
||||
|
||||
thread = threading.Thread(target = kick_thread)
|
||||
|
||||
4
main.py
4
main.py
@@ -38,8 +38,8 @@ shared["load_modules"] = [
|
||||
"adminchat",
|
||||
# Adds /badge, allows to give players achievements
|
||||
"badges",
|
||||
# Adds a few block placement corrections/mods
|
||||
"blockplacemods",
|
||||
# Adds a few block placement corrections/mods
|
||||
"blockplacemods",
|
||||
# Adds /calc, toggles automatic solving of Math expressions in chat
|
||||
"calc",
|
||||
# Plugin to locate laggy chunks. /lc <n> lists chunks with more than n entities
|
||||
|
||||
2
misc.py
2
misc.py
@@ -138,7 +138,7 @@ def on_sudo_command(sender, command, label, args):
|
||||
|
||||
|
||||
|
||||
@simplecommand("me",
|
||||
@simplecommand("me",
|
||||
usage = "[message..]",
|
||||
description = "Sends a message in third person",
|
||||
helpNoargs = True)
|
||||
|
||||
20
player.py
20
player.py
@@ -4,24 +4,24 @@ players = []
|
||||
|
||||
class py_player:
|
||||
|
||||
def __init__(player):
|
||||
self.player = player
|
||||
def __init__(player):
|
||||
self.player = player
|
||||
|
||||
#Properties TODO
|
||||
#Example:
|
||||
self.logging_in = False
|
||||
#Properties TODO
|
||||
#Example:
|
||||
self.logging_in = False
|
||||
|
||||
def get_py_player(player):
|
||||
py_player = players[players.index(player)]
|
||||
return py_player
|
||||
py_player = players[players.index(player)]
|
||||
return py_player
|
||||
|
||||
|
||||
@hook.event("player.PlayerJoinEvent","highest")
|
||||
def on_join(event):
|
||||
player = py_player(event.getPlayer())
|
||||
players.append(player)
|
||||
player = py_player(event.getPlayer())
|
||||
players.append(player)
|
||||
|
||||
|
||||
@hook.event("player.PlayerQuitEvent","highest")
|
||||
def on_leave(event):
|
||||
players.remove(get_py_player(event.getPlayer()))
|
||||
players.remove(get_py_player(event.getPlayer()))
|
||||
|
||||
42
snowbrawl.py
42
snowbrawl.py
@@ -49,7 +49,7 @@ class Arena(object):
|
||||
self.match_goal = None # amount of deaths or time until the match ends (depends on arena_type)
|
||||
self.arena_type = None # arena type (death or time)
|
||||
self.explosion_damage = None
|
||||
|
||||
|
||||
self.player_stats = {}
|
||||
self.players = Queue()
|
||||
self.spawn_location = []
|
||||
@@ -60,7 +60,7 @@ class Arena(object):
|
||||
self.corner1 = None # The corner1 given by the player (really bad for 3D position compare)
|
||||
self.corner2 = None # The corner2 given by the player (really bad for 3D position compare)
|
||||
self.tpp = None # The top, positive x, positive z corner
|
||||
self.bnn = None # The bottom, negative x, negative z corner
|
||||
self.bnn = None # The bottom, negative x, negative z corner
|
||||
|
||||
#set corners of arena
|
||||
def set_corner(self, sender, type):
|
||||
@@ -75,21 +75,21 @@ class Arena(object):
|
||||
#Compares the corner1 and corner2 locations and figures out tpp and bnn so that we dont have to do it everytime we run in_arena()
|
||||
def update_corner_points(self):
|
||||
self.tpp = None
|
||||
self.bnn = None
|
||||
self.bnn = None
|
||||
if self.corner1 == None or self.corner2 == None:
|
||||
return
|
||||
corn1 = self.corner1.get_location()
|
||||
corn2 = self.corner2.get_location()
|
||||
if not corn1.getWorld().getName() == corn2.getWorld().getName():
|
||||
return
|
||||
|
||||
|
||||
top = corn1.y if corn1.y > corn2.y else corn2.y
|
||||
bottom = corn1.y if corn1.y < corn2.y else corn2.y
|
||||
pos_x = corn1.x if corn1.x > corn2.x else corn2.x
|
||||
pos_z = corn1.z if corn1.z > corn2.z else corn2.z
|
||||
neg_x = corn1.x if corn1.x < corn2.x else corn2.x
|
||||
neg_z = corn1.z if corn1.z < corn2.z else corn2.z
|
||||
|
||||
|
||||
self.tpp = Coords(corn1.getWorld(), pos_x, top, pos_z, 0, 0)
|
||||
self.bnn = Coords(corn2.getWorld(), neg_x, bottom, neg_z, 0, 0)
|
||||
|
||||
@@ -118,9 +118,9 @@ class Arena(object):
|
||||
self.start_match()
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
#remove a player from the queue
|
||||
def remove_player(self, player):
|
||||
def remove_player(self, player):
|
||||
if self.queue.contains(player):
|
||||
self.queue.remove(player)
|
||||
return True
|
||||
@@ -132,7 +132,7 @@ class Arena(object):
|
||||
return False
|
||||
loc_tpp = self.tpp.get_location()
|
||||
loc_bnn = self.bnn.get_location()
|
||||
|
||||
|
||||
if loc.y > loc_tpp.y:
|
||||
return False
|
||||
if loc.y < loc_bnn.y:
|
||||
@@ -179,12 +179,12 @@ class Arena(object):
|
||||
alist[i] = alist[i+1]
|
||||
alist[i+1] = temp
|
||||
return alist
|
||||
|
||||
|
||||
@make_synchronized #Jython synchronized block
|
||||
def end_match(self): #End match, sort the players and print the 3 players with least amount of deaths
|
||||
|
||||
|
||||
sorted_list = self.bubbleSort(self.players.read())
|
||||
|
||||
|
||||
for player in self.players.read():
|
||||
if player.isOnline():
|
||||
loc = self.sign_location[0].get_location().get_location()
|
||||
@@ -256,7 +256,7 @@ class Arena(object):
|
||||
|
||||
def get_click_signs(self):
|
||||
return self.sign_click
|
||||
|
||||
|
||||
#Check if player is in the queue
|
||||
def in_queue(self,player):
|
||||
if self.queue.contains(player):
|
||||
@@ -307,7 +307,7 @@ class Arena(object):
|
||||
sign.get_location().set_location(location)
|
||||
break
|
||||
|
||||
#Remove location out of location
|
||||
#Remove location out of location
|
||||
def delete_location(self, name, type):
|
||||
if type == "spawn":
|
||||
for spawn in self.spawn_location[:]:
|
||||
@@ -472,16 +472,16 @@ class Queue(object):
|
||||
|
||||
def __init__(self):
|
||||
self.queue = []
|
||||
|
||||
|
||||
#Appends to queue
|
||||
def put(self,args):
|
||||
self.queue.append(args)
|
||||
|
||||
|
||||
#Returns the first item in the queue and removes it
|
||||
def get(self):
|
||||
if len(self.queue) > 0:
|
||||
return self.queue.pop(0)
|
||||
|
||||
|
||||
else:
|
||||
return False
|
||||
|
||||
@@ -498,7 +498,7 @@ class Queue(object):
|
||||
if player in self.queue:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
#Clear the queue
|
||||
def clear(self):
|
||||
self.queue = []
|
||||
@@ -532,7 +532,7 @@ class timings_runnable(Runnable):
|
||||
self.arena = arena
|
||||
|
||||
def run(self):
|
||||
self.arena.end_match()
|
||||
self.arena.end_match()
|
||||
|
||||
#timings thread to end arenas if their type is time
|
||||
def timings():
|
||||
@@ -545,10 +545,10 @@ def timings():
|
||||
if arena.start_time + arena.match_goal < current_time:
|
||||
timing = timings_runnable(arena)
|
||||
server.getScheduler().runTask(server.getPluginManager().getPlugin("RedstonerUtils"), timing)
|
||||
|
||||
|
||||
time.sleep(0.1)
|
||||
|
||||
|
||||
|
||||
timingsThread = threading.Thread(target = timings)
|
||||
timingsThread.daemon = True #Thread dies if main thread dies
|
||||
timingsThread.start()
|
||||
@@ -663,7 +663,7 @@ def on_quit(event):
|
||||
|
||||
##############################################################################################
|
||||
# Command handling
|
||||
##############################################################################################
|
||||
##############################################################################################
|
||||
|
||||
|
||||
def create_arena(sender, args):
|
||||
|
||||
Reference in New Issue
Block a user