Merge pull request #351 from MinelinkNetwork/master

Add option to allow helpers to WorldEdit
This commit is contained in:
Jesse Boyd 2015-06-11 19:58:02 +10:00
commit 5621570772
3 changed files with 5 additions and 1 deletions

View File

@ -848,6 +848,7 @@ public class PlotSquared {
// WorldEdit
options.put("worldedit.require-selection-in-mask", Settings.REQUIRE_SELECTION);
options.put("worldedit.enable-for-helpers", Settings.WE_ALLOW_HELPER);
options.put("worldedit.max-volume", Settings.WE_MAX_VOLUME);
options.put("worldedit.max-iterations", Settings.WE_MAX_ITERATIONS);
options.put("worldedit.blacklist", Arrays.asList("cs", ".s", "restore", "snapshot", "delchunks", "listchunks"));
@ -928,6 +929,7 @@ public class PlotSquared {
// WorldEdit
Settings.REQUIRE_SELECTION = config.getBoolean("worldedit.require-selection-in-mask");
Settings.WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
Settings.WE_MAX_VOLUME = config.getLong("worldedit.max-volume");
Settings.WE_MAX_ITERATIONS = config.getLong("worldedit.max-iterations");
Settings.WE_BLACKLIST = config.getStringList("worldedit.blacklist");

View File

@ -73,6 +73,7 @@ public class Settings {
* Default worldedit-require-selection-in-mask: false
*/
public static boolean REQUIRE_SELECTION = true;
public static boolean WE_ALLOW_HELPER = false;
public static long WE_MAX_VOLUME = 500000;
public static long WE_MAX_ITERATIONS = 1000;
public static List<String> WE_BLACKLIST = new ArrayList<>();

View File

@ -4,6 +4,7 @@ import java.util.HashSet;
import java.util.UUID;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -27,7 +28,7 @@ public class WEManager {
UUID uuid = player.getUUID();
for (Plot plot : PlotSquared.getPlots(player.getLocation().getWorld()).values()) {
if (!plot.settings.getMerged(0) && !plot.settings.getMerged(3)) {
if (plot.isOwner(uuid) || plot.trusted.contains(uuid)) {
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.trusted.contains(uuid))) {
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);
regions.add(new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()));