summaryrefslogtreecommitdiff
path: root/damnspam.py
diff options
context:
space:
mode:
authorPanFritz <redstonenoobpan@gmail.com>2015-01-09 22:39:20 +0100
committerPanFritz <redstonenoobpan@gmail.com>2015-01-09 22:39:20 +0100
commitd4813f7dc56bfa5085e46ccfdd0e271d9c5029be (patch)
tree23c472f162c3efafacc475a33869bfb7ee794be3 /damnspam.py
parent702c8ec2cfb99c6953f326ae20fa3cdc8a50d726 (diff)
fixed indentation on damnspam
Diffstat (limited to 'damnspam.py')
-rw-r--r--damnspam.py96
1 files changed, 48 insertions, 48 deletions
diff --git a/damnspam.py b/damnspam.py
index b6e0407..14f32b7 100644
--- a/damnspam.py
+++ b/damnspam.py
@@ -40,62 +40,62 @@ def on_dammnspam_command(sender, args):
msg(sender, "&cYou can only do this in Creative mode.")
return True
- # /damnspam <secs>
- if len(args) == 1:
- timeout_on = args[0]
- try:
- timeout_on = round(float(timeout_on), 2)
- timeout_off = timeout_on
- if 60 >= timeout_on <= -2 or timeout_on == 0:
- timeout_on = False
- if timeout_on == False:
- msg(sender, "&cThe timeout must be within 0-60 or -1.")
- return True
- except ValueError:
- msg(sender, "&cThe timeout must be a number")
+ # /damnspam <secs>
+ if len(args) == 1:
+ timeout_on = args[0]
+ try:
+ timeout_on = round(float(timeout_on), 2)
+ timeout_off = timeout_on
+ if 60 >= timeout_on <= -2 or timeout_on == 0:
+ timeout_on = False
+ if timeout_on == False:
+ msg(sender, "&cThe timeout must be within 0-60 or -1.")
return True
+ except ValueError:
+ msg(sender, "&cThe timeout must be a number")
+ return True
- # /damnspam <off> <on>
- elif len(args) == 2:
- timeout_on = args[0]
- timeout_off = args[1]
- try:
- timeout_on = round(float(timeout_on), 2)
- timeout_off = round(float(timeout_off), 2)
- if 60 >= timeout_on <= -2 or timeout_on == 0:
- timeout_on = False
- if 60 >= timeout_off <= -2 or timeout_off == 0:
- timeout_off = False
- if timeout_on == False or timeout_off == False:
- msg(sender, "&cThe timeout must be within 0-60 or -1.")
- return True
- except ValueError:
- msg(sender, "&cThe timeout must be a number")
+ # /damnspam <off> <on>
+ elif len(args) == 2:
+ timeout_on = args[0]
+ timeout_off = args[1]
+ try:
+ timeout_on = round(float(timeout_on), 2)
+ timeout_off = round(float(timeout_off), 2)
+ if 60 >= timeout_on <= -2 or timeout_on == 0:
+ timeout_on = False
+ if 60 >= timeout_off <= -2 or timeout_off == 0:
+ timeout_off = False
+ if timeout_on == False or timeout_off == False:
+ msg(sender, "&cThe timeout must be within 0-60 or -1.")
return True
-
- # get the block we're looking at
- target = sender.getTargetBlock(None, 10)
- ttype = str(target.getType())
- if ttype not in accepted_inputs:
- msg(sender, "&cPlease look at a button or lever while executing this command!")
+ except ValueError:
+ msg(sender, "&cThe timeout must be a number")
return True
- if location_str(target) in inputs:
- changing_input = True # this input already has a timeout
- # test if player is allowed to build here
- test_event = BlockBreakEvent(target, sender)
- server.getPluginManager().callEvent(test_event)
- changing_input = False
- if test_event.isCancelled():
- msg(sender, "&cYou are not allowed to modify this %s" % str(target.getType()).lower())
- return True
+ # get the block we're looking at
+ target = sender.getTargetBlock(None, 10)
+ ttype = str(target.getType())
+ if ttype not in accepted_inputs:
+ msg(sender, "&cPlease look at a button or lever while executing this command!")
+ return True
- # add block to inputs
- add_input(sender, target, timeout_off, timeout_on)
- save_inputs()
- msg(sender, "&aSuccessfully set a timeout for this %s." % ttype.lower().replace("_", " "))
+ if location_str(target) in inputs:
+ changing_input = True # this input already has a timeout
+ # test if player is allowed to build here
+ test_event = BlockBreakEvent(target, sender)
+ server.getPluginManager().callEvent(test_event)
+ changing_input = False
+ if test_event.isCancelled():
+ msg(sender, "&cYou are not allowed to modify this %s" % str(target.getType()).lower())
return True
+ # add block to inputs
+ add_input(sender, target, timeout_off, timeout_on)
+ save_inputs()
+ msg(sender, "&aSuccessfully set a timeout for this %s." % ttype.lower().replace("_", " "))
+ return True
+
@hook.event("block.BlockBreakEvent", "normal")
def on_block_break(event):