From 5c58f14d1a707bd7ff20b5c02169e92e61207ba6 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 19 Apr 2015 23:55:01 +1000 Subject: [PATCH] Worldedit mask --- .../java/com/intellectualcrafters/plot/config/C.java | 2 +- .../plot/listeners/worldedit/WEListener.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java index 1666968da..7539ad60f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -89,7 +89,7 @@ public enum C { WORLDEDIT_VOLUME("$2You cannot select a volume of %current%. The maximum volume you can modify is %max%."), WORLDEDIT_ITERATIONS("$2You cannot iterate %current% times. The maximum number of iterations allowed is %max%."), WORLDEDIT_UNSAFE("$2Access to that command has been blocked"), - WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $3/plot wea"), + WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea"), WORLDEDIT_UNMASKED("$1Your WorldEdit is now unrestricted."), WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted."), /* diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java index cf100dd69..a1182c30d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java @@ -118,15 +118,16 @@ public class WEListener implements Listener { final BlockVector pos1 = selection.getNativeMinimumPoint().toBlockVector(); final BlockVector pos2 = selection.getNativeMaximumPoint().toBlockVector(); HashSet mask = WEManager.getMask(pp); + RegionWrapper region = new RegionWrapper(pos1.getBlockX(), pos2.getBlockX(), pos1.getBlockZ(), pos2.getBlockZ()); if (Settings.REQUIRE_SELECTION) { String arg = null; - if (mask.size() == 0) { + if (!WEManager.regionContains(region, mask)) { arg = "pos1 + pos2"; } - if (!WEManager.maskContains(mask, pos1.getBlockX(), pos1.getBlockZ())) { + else if (!WEManager.maskContains(mask, pos1.getBlockX(), pos1.getBlockZ())) { arg = "pos1"; } - if (!WEManager.maskContains(mask, pos2.getBlockX(), pos2.getBlockZ())) { + else if (!WEManager.maskContains(mask, pos2.getBlockX(), pos2.getBlockZ())) { arg = "pos2"; } if (arg != null) { @@ -138,7 +139,6 @@ public class WEListener implements Listener { return true; } } - RegionWrapper region = new RegionWrapper(pos1.getBlockX(), pos2.getBlockX(), pos1.getBlockZ(), pos2.getBlockZ()); if (!WEManager.regionContains(region, mask)) { MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "pos1 + pos2"); e.setCancelled(true); @@ -155,7 +155,7 @@ public class WEListener implements Listener { public boolean onPlayerCommand(final PlayerCommandPreprocessEvent e) { final Player p = e.getPlayer(); final PlotPlayer pp = BukkitUtil.getPlayer(p); - if (!PlotSquared.isPlotWorld(p.getWorld().getName()) || Permissions.hasPermission(pp, "plots.worldedit.bypass")) { + if (!PlotSquared.isPlotWorld(p.getWorld().getName())) { return true; } String cmd = e.getMessage().toLowerCase();