Fixed minor WorldEdit quirk

This commit is contained in:
boy0001 2014-12-18 13:36:49 +11:00
parent 59be72aefe
commit 4f7f439a2a

View File

@ -28,11 +28,13 @@ import java.util.Set;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
@ -245,4 +247,23 @@ public class WorldEditListener implements Listener {
} }
PWE.setMask(p, q); PWE.setMask(p, q);
} }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onWorldChange(final PlayerChangedWorldEvent e) {
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
return;
}
final Player p = e.getPlayer();
final Location t = p.getLocation();
final World f = e.getFrom();
if (!isPlotWorld(t)) {
if (PlotMain.isPlotWorld(f)) {
PWE.removeMask(p);
}
else {
return;
}
}
}
} }