disable spectator teleportation

This commit is contained in:
jomo
2015-01-06 21:29:00 +01:00
parent 3e6683725e
commit 6310633ebb

View File

@@ -181,3 +181,12 @@ def on_modules_command(sender, args):
for mod in shared["load_modules"]: for mod in shared["load_modules"]:
color = "a" if mod in shared["modules"] else "c" color = "a" if mod in shared["modules"] else "c"
msg(sender, "&" + color + mod) msg(sender, "&" + color + mod)
# Disable spectator teleportation
@hook.event("player.PlayerTeleportEvent")
def on_player_teleport(event):
player = event.getPlayer()
if not event.isCancelled() and str(event.getCause()) == "SPECTATE" and not player.hasPermission("utils.tp.spectate"):
event.setCancelled(True)
msg(event.getPlayer(), "&cSpectator teleportation is disabled")