diff options
author | jomo <github@jomo.tv> | 2014-08-08 05:14:22 +0200 |
---|---|---|
committer | jomo <github@jomo.tv> | 2014-08-08 05:14:22 +0200 |
commit | 10d8498ce4157d6e684173ddb6c44df0bd1534e1 (patch) | |
tree | 2e43d48f4591abbdab709befb507502dabd8f7e9 /damnspam.py | |
parent | 8ecae8fe232da3eafff8a1c54224492dfab9e171 (diff) |
check if player is allowed to remove input
Diffstat (limited to 'damnspam.py')
-rw-r--r-- | damnspam.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/damnspam.py b/damnspam.py index cae8ec4..ed0ffaa 100644 --- a/damnspam.py +++ b/damnspam.py @@ -100,11 +100,18 @@ def on_block_break(event): if inputs.get(pos_str): plugin_header(sender, "DamnSpam") if sender.isSneaking(): + # test if player is allowed to build here + test_event = BlockBreakEvent(block, sender) + server.getPluginManager().callEvent(test_event) + if test_event.isCancelled(): + event.setCancelled(True) + msg(sender, "&cYou are not allowed to remove this input") + return True inputs.pop(pos_str) # remove save_inputs() - msg(sender, "&eSuccessfully removed the input!") + msg(sender, "&eSuccessfully removed this input!") return True - elif not changing_input: # FIXME: does this work?? + elif not changing_input: event.setCancelled(True) msg(sender, "&cYou cannot destroy this input!") msg(sender, "&c&nSneak&c and break if you want to remove it.") |