diff options
author | Dico200 <dico.karssiens@gmail.com> | 2015-04-14 21:20:45 +0200 |
---|---|---|
committer | Dico200 <dico.karssiens@gmail.com> | 2015-04-14 21:20:55 +0200 |
commit | 2c1292015b5c8a7520d62d6902932eff7211f52c (patch) | |
tree | 29b8a3ecf3edc4de4c297c210310cccde264f1ab /misc.py | |
parent | f45da9bf42b3f8d33b5d01083dc9280062e685f7 (diff) |
Made lava not break redstone components in Creative
I tested thoroughly. I don't see how this will break other parts of the
plugin either.
Diffstat (limited to 'misc.py')
-rw-r--r-- | misc.py | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -212,6 +212,25 @@ def on_player_teleport(event): event.setCancelled(True) msg(event.getPlayer(), "&cSpectator teleportation is disabled") +@hook.event("block.BlockFromToEvent", "highest") +def on_flow(event): + if event.isCancelled(): + return + block = event.getToBlock() + if block.getWorld().getName() == "Creative" and rs_material_broken_by_flow(str(block.getType())): + event.setCancelled(True) + +def rs_material_broken_by_flow(material): + if material in ("REDSTONE", "LEVER", "TRIPWIRE"): + return True + parts = material.split("_") + length = len(parts) + return length > 1 and (parts[0] == "DIODE" or parts[1] in ("TORCH", "WIRE", "BUTTON", "HOOK") or (length == 3 and parts[1] == "COMPARATOR")) + + + + + """ @hook.event("player.AsyncPlayerChatEvent", "lowest") def on_chat(event): |