mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 13:05:41 +01:00
Worldedit mask
This commit is contained in:
parent
d8fbd90c52
commit
5c58f14d1a
@ -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_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_ITERATIONS("$2You cannot iterate %current% times. The maximum number of iterations allowed is %max%."),
|
||||||
WORLDEDIT_UNSAFE("$2Access to that command has been blocked"),
|
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_UNMASKED("$1Your WorldEdit is now unrestricted."),
|
||||||
WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted."),
|
WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted."),
|
||||||
/*
|
/*
|
||||||
|
@ -118,15 +118,16 @@ public class WEListener implements Listener {
|
|||||||
final BlockVector pos1 = selection.getNativeMinimumPoint().toBlockVector();
|
final BlockVector pos1 = selection.getNativeMinimumPoint().toBlockVector();
|
||||||
final BlockVector pos2 = selection.getNativeMaximumPoint().toBlockVector();
|
final BlockVector pos2 = selection.getNativeMaximumPoint().toBlockVector();
|
||||||
HashSet<RegionWrapper> mask = WEManager.getMask(pp);
|
HashSet<RegionWrapper> mask = WEManager.getMask(pp);
|
||||||
|
RegionWrapper region = new RegionWrapper(pos1.getBlockX(), pos2.getBlockX(), pos1.getBlockZ(), pos2.getBlockZ());
|
||||||
if (Settings.REQUIRE_SELECTION) {
|
if (Settings.REQUIRE_SELECTION) {
|
||||||
String arg = null;
|
String arg = null;
|
||||||
if (mask.size() == 0) {
|
if (!WEManager.regionContains(region, mask)) {
|
||||||
arg = "pos1 + pos2";
|
arg = "pos1 + pos2";
|
||||||
}
|
}
|
||||||
if (!WEManager.maskContains(mask, pos1.getBlockX(), pos1.getBlockZ())) {
|
else if (!WEManager.maskContains(mask, pos1.getBlockX(), pos1.getBlockZ())) {
|
||||||
arg = "pos1";
|
arg = "pos1";
|
||||||
}
|
}
|
||||||
if (!WEManager.maskContains(mask, pos2.getBlockX(), pos2.getBlockZ())) {
|
else if (!WEManager.maskContains(mask, pos2.getBlockX(), pos2.getBlockZ())) {
|
||||||
arg = "pos2";
|
arg = "pos2";
|
||||||
}
|
}
|
||||||
if (arg != null) {
|
if (arg != null) {
|
||||||
@ -138,7 +139,6 @@ public class WEListener implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegionWrapper region = new RegionWrapper(pos1.getBlockX(), pos2.getBlockX(), pos1.getBlockZ(), pos2.getBlockZ());
|
|
||||||
if (!WEManager.regionContains(region, mask)) {
|
if (!WEManager.regionContains(region, mask)) {
|
||||||
MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "pos1 + pos2");
|
MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "pos1 + pos2");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
@ -155,7 +155,7 @@ public class WEListener implements Listener {
|
|||||||
public boolean onPlayerCommand(final PlayerCommandPreprocessEvent e) {
|
public boolean onPlayerCommand(final PlayerCommandPreprocessEvent e) {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(p);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
String cmd = e.getMessage().toLowerCase();
|
String cmd = e.getMessage().toLowerCase();
|
||||||
|
Loading…
Reference in New Issue
Block a user