repalce input with lever/button
This commit is contained in:
11
damnspam.py
11
damnspam.py
@@ -78,7 +78,7 @@ def on_dammnspam_command(sender, args):
|
|||||||
server.getPluginManager().callEvent(test_event)
|
server.getPluginManager().callEvent(test_event)
|
||||||
changing_input = False
|
changing_input = False
|
||||||
if test_event.isCancelled():
|
if test_event.isCancelled():
|
||||||
msg(sender, "&cYou are not allowed to modify this input")
|
msg(sender, "&cYou are not allowed to modify this %s" % str(target.getType()).lower())
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# add block to inputs
|
# add block to inputs
|
||||||
@@ -99,7 +99,8 @@ def on_block_break(event):
|
|||||||
if removing_input:
|
if removing_input:
|
||||||
return True
|
return True
|
||||||
sender = event.getPlayer()
|
sender = event.getPlayer()
|
||||||
block = event.getBlock()
|
block = event.getBlock()
|
||||||
|
btype = str(block.getType()).lower()
|
||||||
if str(block.getType()) in accepted_inputs and not event.isCancelled():
|
if str(block.getType()) in accepted_inputs and not event.isCancelled():
|
||||||
pos_str = location_str(block)
|
pos_str = location_str(block)
|
||||||
if inputs.get(pos_str):
|
if inputs.get(pos_str):
|
||||||
@@ -112,15 +113,15 @@ def on_block_break(event):
|
|||||||
removing_input = False
|
removing_input = False
|
||||||
if test_event.isCancelled():
|
if test_event.isCancelled():
|
||||||
event.setCancelled(True)
|
event.setCancelled(True)
|
||||||
msg(sender, "&cYou are not allowed to remove this input")
|
msg(sender, "&cYou are not allowed to remove this %s" % btype)
|
||||||
return True
|
return True
|
||||||
inputs.pop(pos_str) # remove
|
inputs.pop(pos_str) # remove
|
||||||
save_inputs()
|
save_inputs()
|
||||||
msg(sender, "&eSuccessfully removed this input!")
|
msg(sender, "&eSuccessfully removed this %s!" % btype)
|
||||||
return True
|
return True
|
||||||
elif not changing_input:
|
elif not changing_input:
|
||||||
event.setCancelled(True)
|
event.setCancelled(True)
|
||||||
msg(sender, "&cYou cannot destroy this input!")
|
msg(sender, "&cYou cannot destroy this %s!" % btype)
|
||||||
msg(sender, "&c&nSneak&c and break if you want to remove it.")
|
msg(sender, "&c&nSneak&c and break if you want to remove it.")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user