diff options
author | Dico200 <dico.karssiens@gmail.com> | 2015-06-06 12:13:18 +0200 |
---|---|---|
committer | Dico200 <dico.karssiens@gmail.com> | 2015-06-06 12:13:18 +0200 |
commit | 40137cad4c62126cada585223064324d0aafc118 (patch) | |
tree | 676f0c12b9a09c6ae94efb39617f76f0db53ef81 /misc.py | |
parent | 35b1fe3a0feb5226ed0c17e41025c507045425bd (diff) |
This /up fix SHOULD WORK!
Diffstat (limited to 'misc.py')
-rw-r--r-- | misc.py | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -37,14 +37,39 @@ def on_join(event): msg(player, "&6You can use /back if you &nreally&6 want to go back") player.teleport(player.getWorld().getSpawnLocation()) +""" +This code fixes /up 0 destroying/replacing blocks in plots that are not yours. +If you use //up, this is caught by plotme and cancelled if you are not allowed to build. +However, if you use //up, WorldEdit does the following on "low" priority: +* Change the command to /up with the same arguments +* Run another event with /up but its cancelled (dunno why it does this) + +Keep in mind that, on "lowest" priority, PlotMe might cancel events. + """ -@hook.event("player.PlayerCommandPreprocessEvent", "low") +dup = 0 #Used to store when someone used //up + +@hook.event("player.PlayerCommandPreprocessEvent", "lowest") def cmd_event(event): + global dup + if event.getMessage().split(" ")[0] in ("//up", "/worldedit:/up"): + dup = True + +@hook.event("player.PlayerCommandPreprocessEvent", "normal") +def cmd_event2(event): + global dup args = event.getMessage().split(" ") if args[0].lower() in ("/up", "/worldedit:up"): - event.setMessage("//up " + " ".join(args[1:])) -""" + if dup: #If plotme cancelled this, it will not matter. This lets it through but PlotMe doesn't. + dup = False + elif not event.isCancelled(): + event.setCancelled(True) + event.getPlayer().chat("//up " + " ".join(args[1:])) + + + + """ Disabled while builder can't access Trusted @hook.event("player.PlayerGameModeChangeEvent", "low") |