From 2c1292015b5c8a7520d62d6902932eff7211f52c Mon Sep 17 00:00:00 2001 From: Dico200 Date: Tue, 14 Apr 2015 21:20:45 +0200 Subject: [PATCH] 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. --- misc.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/misc.py b/misc.py index 6021f46..a530424 100644 --- a/misc.py +++ b/misc.py @@ -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):