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.
This commit is contained in:
Dico200
2015-04-14 21:20:45 +02:00
parent f45da9bf42
commit 2c1292015b

19
misc.py
View File

@@ -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):