mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Several changes:
- Several API improvements - persistent WorldEdit bypass toggle - persistent plot chat toggle - Plot BO3 exporting (useful f - Fix fastmode clearing unclaim border - Add player-interact flag for NPC interaction etc. Fixes #543 - Several fixes for sponge - some code cleanup - Closes #529
This commit is contained in:
		@@ -168,12 +168,12 @@ public class PS {
 | 
			
		||||
                IMP.runEntityTask();
 | 
			
		||||
            }
 | 
			
		||||
            // Events
 | 
			
		||||
            IMP.registerWorldEditEvents();
 | 
			
		||||
            IMP.registerCommands();
 | 
			
		||||
            IMP.registerPlayerEvents();
 | 
			
		||||
            IMP.registerInventoryEvents();
 | 
			
		||||
            IMP.registerPlotPlusEvents();
 | 
			
		||||
            IMP.registerForceFieldEvents();
 | 
			
		||||
            IMP.registerWorldEditEvents();
 | 
			
		||||
            IMP.registerWorldEvents();
 | 
			
		||||
            if (Settings.METRICS) {
 | 
			
		||||
                IMP.startMetrics();
 | 
			
		||||
@@ -1645,6 +1645,7 @@ public class PS {
 | 
			
		||||
        FlagManager.addFlag(new AbstractFlag("animal-attack", new FlagValue.BooleanValue()));
 | 
			
		||||
        FlagManager.addFlag(new AbstractFlag("tamed-interact", new FlagValue.BooleanValue()));
 | 
			
		||||
        FlagManager.addFlag(new AbstractFlag("tamed-attack", new FlagValue.BooleanValue()));
 | 
			
		||||
        FlagManager.addFlag(new AbstractFlag("player-interact", new FlagValue.BooleanValue()));
 | 
			
		||||
        FlagManager.addFlag(new AbstractFlag("misc-interact", new FlagValue.BooleanValue()));
 | 
			
		||||
        FlagManager.addFlag(new AbstractFlag("misc-place", new FlagValue.BooleanValue()));
 | 
			
		||||
        FlagManager.addFlag(new AbstractFlag("misc-break", new FlagValue.BooleanValue()));
 | 
			
		||||
@@ -1799,6 +1800,7 @@ public class PS {
 | 
			
		||||
 | 
			
		||||
        // Schematics
 | 
			
		||||
        options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
 | 
			
		||||
        options.put("bo3.save_path", Settings.BO3_SAVE_PATH);
 | 
			
		||||
        
 | 
			
		||||
        // Web
 | 
			
		||||
        options.put("web.url", Settings.WEB_URL);
 | 
			
		||||
@@ -1906,6 +1908,7 @@ public class PS {
 | 
			
		||||
        
 | 
			
		||||
        // Schematics
 | 
			
		||||
        Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
 | 
			
		||||
        Settings.BO3_SAVE_PATH = config.getString("bo3.save_path");
 | 
			
		||||
        
 | 
			
		||||
        // Web
 | 
			
		||||
        Settings.WEB_URL = config.getString("web.url");
 | 
			
		||||
 
 | 
			
		||||
@@ -24,8 +24,10 @@ package com.intellectualcrafters.plot.api;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Location;
 | 
			
		||||
import org.bukkit.OfflinePlayer;
 | 
			
		||||
import org.bukkit.World;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.plugin.java.JavaPlugin;
 | 
			
		||||
@@ -67,22 +69,27 @@ public class PlotAPI {
 | 
			
		||||
    /**
 | 
			
		||||
     * Permission that allows for admin access, this permission node will allow the player to use any part of the
 | 
			
		||||
     * plugin, without limitations.
 | 
			
		||||
     * @deprecated Use C.PERMISSION_ADMIN.s() instead
 | 
			
		||||
     */
 | 
			
		||||
    public static final String ADMIN_PERMISSION = "plots.admin";
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public static final String ADMIN_PERMISSION = C.PERMISSION_ADMIN.s();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor. Insert any Plugin. (Optimally the plugin that is accessing the method)
 | 
			
		||||
     *
 | 
			
		||||
     * @param plugin Plugin used to access this method
 | 
			
		||||
     *
 | 
			
		||||
     * @throws com.intellectualcrafters.plot.util.PlotSquaredException if the program fails to fetch the PlotSquared
 | 
			
		||||
     *                                                                 instance
 | 
			
		||||
     * @see com.intellectualcrafters.plot.PS
 | 
			
		||||
     * @deprecated Use new PlotAPI() instead
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public PlotAPI(final JavaPlugin plugin) {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @param plugin Plugin used to access this method
 | 
			
		||||
     *
 | 
			
		||||
     * @throws com.intellectualcrafters.plot.util.PlotSquaredException if the program fails to fetch the PlotSquared
 | 
			
		||||
     *                                                                 instance
 | 
			
		||||
     * @see com.intellectualcrafters.plot.PS
 | 
			
		||||
     * 
 | 
			
		||||
     * @deprecated Use new PlotAPI() instead
 | 
			
		||||
     */
 | 
			
		||||
    public PlotAPI() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -241,16 +248,22 @@ public class PlotAPI {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Do not use this. Instead use Permissions.[method] in your code.
 | 
			
		||||
     * Do not use this. Instead use C.PERMISSION_[method] in your code.
 | 
			
		||||
     *  - Basic permission management stuff
 | 
			
		||||
     *
 | 
			
		||||
     * @return MainUtil
 | 
			
		||||
     * @return Array of strings
 | 
			
		||||
     *
 | 
			
		||||
     * @see com.intellectualcrafters.plot.util.Permissions
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public Permissions[] getPermissions() {
 | 
			
		||||
        return Permissions.values();
 | 
			
		||||
    public String[] getPermissions() {
 | 
			
		||||
        ArrayList<String> perms = new ArrayList<>();
 | 
			
		||||
        for (C c : C.values()) {
 | 
			
		||||
            if (c.getCat().equals("static.permissions")) {
 | 
			
		||||
                perms.add(c.s());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return perms.toArray(new String[0]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -671,4 +684,54 @@ public class PlotAPI {
 | 
			
		||||
        PlotPlayer pp = BukkitUtil.getPlayer(player);
 | 
			
		||||
        return MainUtil.getAllowedPlots(pp);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the PlotPlayer for a player<br>
 | 
			
		||||
     *  - The PlotPlayer is usually cached and will provide useful functions relating to players
 | 
			
		||||
     * 
 | 
			
		||||
     * @see PlotPlayer.wrap(Player|OfflinePlayer|String|UUID)
 | 
			
		||||
     * 
 | 
			
		||||
     * @param player
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public PlotPlayer wrapPlayer(Player player) {
 | 
			
		||||
        return PlotPlayer.wrap(player);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the PlotPlayer for a UUID (Please note that PlotSquared can be configured to provide different UUIDs than bukkit)
 | 
			
		||||
     * 
 | 
			
		||||
     * @see PlotPlayer.wrap(UUID uuid)
 | 
			
		||||
     * 
 | 
			
		||||
     * @param player
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public PlotPlayer wrapPlayer(UUID uuid) {
 | 
			
		||||
        return PlotPlayer.wrap(uuid);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the PlotPlayer for a username
 | 
			
		||||
     * 
 | 
			
		||||
     * @see PlotPlayer.wrap(String name)
 | 
			
		||||
     * 
 | 
			
		||||
     * @param player
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public PlotPlayer wrapPlayer(String player) {
 | 
			
		||||
        return PlotPlayer.wrap(player);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the PlotPlayer for an offline player<br>
 | 
			
		||||
     * Note that this will work if the player is offline, however not all functionality will work
 | 
			
		||||
     * 
 | 
			
		||||
     * @see PlotPlayer.wrap(OfflinePlayer op)
 | 
			
		||||
     * 
 | 
			
		||||
     * @param player
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public PlotPlayer wrapPlayer(OfflinePlayer player) {
 | 
			
		||||
        return PlotPlayer.wrap(player);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -153,7 +153,7 @@ public class Auto extends SubCommand {
 | 
			
		||||
                sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
 | 
			
		||||
            if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !Permissions.hasPermission(plr, "plots.admin.command.schematic")) {
 | 
			
		||||
                MainUtil.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,90 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// PlotSquared - A plot manager and world generator for the Bukkit API                             /
 | 
			
		||||
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters                                       /
 | 
			
		||||
//                                                                                                 /
 | 
			
		||||
// This program is free software; you can redistribute it and/or modify                            /
 | 
			
		||||
// it under the terms of the GNU General Public License as published by                            /
 | 
			
		||||
// the Free Software Foundation; either version 3 of the License, or                               /
 | 
			
		||||
// (at your option) any later version.                                                             /
 | 
			
		||||
//                                                                                                 /
 | 
			
		||||
// This program is distributed in the hope that it will be useful,                                 /
 | 
			
		||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                  /
 | 
			
		||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                   /
 | 
			
		||||
// GNU General Public License for more details.                                                    /
 | 
			
		||||
//                                                                                                 /
 | 
			
		||||
// You should have received a copy of the GNU General Public License                               /
 | 
			
		||||
// along with this program; if not, write to the Free Software Foundation,                         /
 | 
			
		||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA                               /
 | 
			
		||||
//                                                                                                 /
 | 
			
		||||
// You can contact us via: support@intellectualsites.com                                           /
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.Flag;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.FlagManager;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.HybridUtils;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RunnableVal;
 | 
			
		||||
import com.intellectualcrafters.plot.util.BO3Handler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.BlockManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "bo3",
 | 
			
		||||
        aliases = {"bo2"},
 | 
			
		||||
        description = "Mark a plot as done",
 | 
			
		||||
        permission = "plots.done",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = RequiredType.NONE
 | 
			
		||||
)
 | 
			
		||||
public class BO3 extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    public void noArgs(PlotPlayer plr) {
 | 
			
		||||
        MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot bo3 export [category] [alias] [-r]");
 | 
			
		||||
        MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot bo3 import <file>");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null || !plot.hasOwner()) {
 | 
			
		||||
            return !sendMessage(plr, C.NOT_IN_PLOT);
 | 
			
		||||
        }
 | 
			
		||||
        if ((!plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.bo3")) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (args.length == 0) {
 | 
			
		||||
            noArgs(plr);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        switch (args[0].toLowerCase()) {
 | 
			
		||||
            case "output":
 | 
			
		||||
            case "save":
 | 
			
		||||
            case "export": {
 | 
			
		||||
                return BO3Handler.saveBO3(plr, plot);
 | 
			
		||||
            }
 | 
			
		||||
            case "paste":
 | 
			
		||||
            case "load":
 | 
			
		||||
            case "import":
 | 
			
		||||
            case "input": {
 | 
			
		||||
                // TODO NOT IMPLEMENTED YET
 | 
			
		||||
                MainUtil.sendMessage(plr, "NOT IMPLEMENTED YET!!!");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            default: {
 | 
			
		||||
                noArgs(plr);
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -17,25 +17,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
public class Chat extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        
 | 
			
		||||
        final String world = plr.getLocation().getWorld();
 | 
			
		||||
        if (!PS.get().isPlotWorld(world)) {
 | 
			
		||||
            return !sendMessage(plr, C.NOT_IN_PLOT_WORLD);
 | 
			
		||||
        }
 | 
			
		||||
        boolean enable = !(plr.getMeta("chat") != null && (Boolean) plr.getMeta("chat"));
 | 
			
		||||
        if (args.length > 0) {
 | 
			
		||||
            if (args[0].equalsIgnoreCase("on")) {
 | 
			
		||||
                enable = true;
 | 
			
		||||
            } else if (args[0].equalsIgnoreCase("off")) {
 | 
			
		||||
                enable = false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        final PlotWorld plotworld = PS.get().getPlotWorld(world);
 | 
			
		||||
        if (!enable && plotworld.PLOT_CHAT) {
 | 
			
		||||
            return !sendMessage(plr, C.PLOT_CHAT_FORCED);
 | 
			
		||||
        }
 | 
			
		||||
        plr.setMeta("chat", enable);
 | 
			
		||||
        return sendMessage(plr, enable ? C.PLOT_CHAT_ON : C.PLOT_CHAT_OFF);
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String ... args) {
 | 
			
		||||
        return MainCommand.onCommand(player, "plot", new String[] {"toggle", "chat"});
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -129,7 +129,7 @@ public class Claim extends SubCommand {
 | 
			
		||||
                if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
 | 
			
		||||
                    return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
 | 
			
		||||
                }
 | 
			
		||||
                if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin.command.schematic")) {
 | 
			
		||||
                if (!Permissions.hasPermission(plr, "plots.claim." + schematic) && !Permissions.hasPermission(plr, "plots.admin.command.schematic")) {
 | 
			
		||||
                    return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "continue",
 | 
			
		||||
        description = "Continue a plot that was previously marked as done",
 | 
			
		||||
        permission = "plots.done",
 | 
			
		||||
        permission = "plots.continue",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = RequiredType.NONE
 | 
			
		||||
)
 | 
			
		||||
@@ -52,7 +52,7 @@ public class Continue extends SubCommand {
 | 
			
		||||
        if (plot == null || !plot.hasOwner()) {
 | 
			
		||||
            return !sendMessage(plr, C.NOT_IN_PLOT);
 | 
			
		||||
        }
 | 
			
		||||
        if ((!plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) {
 | 
			
		||||
        if ((!plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.continue")) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -54,7 +54,7 @@ public class Copy extends SubCommand {
 | 
			
		||||
        if (plot1 == null) {
 | 
			
		||||
            return !MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Permissions.ADMIN.s))  {
 | 
			
		||||
        if (!plot1.isAdded(plr.getUUID()) && !Permissions.hasPermission(plr, C.PERMISSION_ADMIN.s()))  {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -157,9 +157,6 @@ public class DebugExec extends SubCommand {
 | 
			
		||||
        for (Enum<?> value : C.values()) {
 | 
			
		||||
            scope.put("C_" + value.name(), value);
 | 
			
		||||
        }
 | 
			
		||||
        for (Enum<?> value : Permissions.values()) {
 | 
			
		||||
            scope.put("Permissions_" + value.name(), value);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ public class Done extends SubCommand {
 | 
			
		||||
        if (plot == null || !plot.hasOwner()) {
 | 
			
		||||
            return !sendMessage(plr, C.NOT_IN_PLOT);
 | 
			
		||||
        }
 | 
			
		||||
        if ((!plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) {
 | 
			
		||||
        if ((!plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.done")) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ public class FlagCmd extends SubCommand {
 | 
			
		||||
            sendMessage(player, C.PLOT_NOT_CLAIMED);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot.isAdded(player.getUUID()) && !Permissions.hasPermission(player, "plots.set.flag.other")) {
 | 
			
		||||
        if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.set.flag.other")) {
 | 
			
		||||
            MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -129,6 +129,8 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
        createCommand(new Chat());
 | 
			
		||||
        createCommand(new Trim());
 | 
			
		||||
        createCommand(new Done());
 | 
			
		||||
        createCommand(new Continue());
 | 
			
		||||
        createCommand(new BO3());
 | 
			
		||||
        if (Settings.ENABLE_CLUSTERS) {
 | 
			
		||||
            MainCommand.getInstance().addCommand(new Cluster());
 | 
			
		||||
        }
 | 
			
		||||
@@ -419,7 +421,7 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
            }
 | 
			
		||||
            return CommandHandlingOutput.CALLER_OF_WRONG_TYPE;
 | 
			
		||||
        }
 | 
			
		||||
        if (!plr.hasPermission(cmd.getPermission())) {
 | 
			
		||||
        if (!Permissions.hasPermission(plr, cmd.getPermission())) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NO_PERMISSION, cmd.getPermission());
 | 
			
		||||
            return CommandHandlingOutput.NOT_PERMITTED;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -175,8 +175,8 @@ public class Merge extends SubCommand {
 | 
			
		||||
            multiUUID.add(u2);
 | 
			
		||||
        }
 | 
			
		||||
        if (multiMerge) {
 | 
			
		||||
            if (!Permissions.hasPermission(plr, Permissions.MERGE_OTHER)) {
 | 
			
		||||
                MainUtil.sendMessage(plr, C.NO_PERMISSION, Permissions.MERGE_OTHER.s);
 | 
			
		||||
            if (!Permissions.hasPermission(plr, C.PERMISSION_MERGE_OTHER)) {
 | 
			
		||||
                MainUtil.sendMessage(plr, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER.s());
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            for (final UUID uuid : multiUUID) {
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ public class Move extends SubCommand {
 | 
			
		||||
        if (plot1 == null) {
 | 
			
		||||
            return !sendMessage(plr, C.NOT_IN_PLOT);
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Permissions.ADMIN.s))  {
 | 
			
		||||
        if (!plot1.isAdded(plr.getUUID()) && !Permissions.hasPermission(plr, C.PERMISSION_ADMIN.s()))  {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ public class Set extends SubCommand {
 | 
			
		||||
            sendMessage(plr, C.PLOT_NOT_CLAIMED);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot.isAdded(plr.getUUID())) {
 | 
			
		||||
        if (!plot.isOwner(plr.getUUID())) {
 | 
			
		||||
            if (!Permissions.hasPermission(plr, "plots.set.other")) {
 | 
			
		||||
                MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.other");
 | 
			
		||||
                return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -20,17 +20,25 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
import com.plotsquared.bukkit.BukkitMain;
 | 
			
		||||
import com.plotsquared.general.commands.Command;
 | 
			
		||||
import com.plotsquared.general.commands.CommandCaller;
 | 
			
		||||
import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
 | 
			
		||||
//     TOGGLE("toggle", "attribute"),
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "toggle",
 | 
			
		||||
        aliases = {"attribute"},
 | 
			
		||||
        permission = "plots.toggle",
 | 
			
		||||
        permission = "plots.use",
 | 
			
		||||
        description = "Toggle per user settings",
 | 
			
		||||
        usage = "/plot toggle <setting>",
 | 
			
		||||
        requiredType = RequiredType.NONE,
 | 
			
		||||
@@ -40,7 +48,66 @@ public class Toggle extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    public void noArgs(PlotPlayer plr) {
 | 
			
		||||
        MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot toggle <setting>");
 | 
			
		||||
        MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + "titles");
 | 
			
		||||
        ArrayList<String> options = new ArrayList<>();
 | 
			
		||||
        for (Entry<String, Command<PlotPlayer>> entry : toggles.entrySet()) {
 | 
			
		||||
            if (Permissions.hasPermission(plr, entry.getValue().getPermission())) {
 | 
			
		||||
                options.add(entry.getKey());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (options.size() > 0) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan.join(options, ","));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    private HashMap<String, Command<PlotPlayer>> toggles;
 | 
			
		||||
    
 | 
			
		||||
    public Toggle() {
 | 
			
		||||
        toggles = new HashMap<>();
 | 
			
		||||
        toggles.put("titles", 
 | 
			
		||||
            new Command<PlotPlayer>("titles", "/plot toggle titles", "Toggle titles for yourself", C.PERMISSION_PLOT_TOGGLE_TITLES.s()) {
 | 
			
		||||
            
 | 
			
		||||
            @Override
 | 
			
		||||
            public boolean onCommand(PlotPlayer player, String[] args) {
 | 
			
		||||
                if (toggle(player, "disabletitles")) {
 | 
			
		||||
                    MainUtil.sendMessage(player, C.TOGGLE_ENABLED, getCommand());
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    MainUtil.sendMessage(player, C.TOGGLE_DISABLED, getCommand());
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        toggles.put("chat", 
 | 
			
		||||
            new Command<PlotPlayer>("chat", "/plot toggle chat", "Toggle plot chat for yourself", C.PERMISSION_PLOT_TOGGLE_CHAT.s()) {
 | 
			
		||||
            
 | 
			
		||||
            @Override
 | 
			
		||||
            public boolean onCommand(PlotPlayer player, String[] args) {
 | 
			
		||||
                if (toggle(player, "chat")) {
 | 
			
		||||
                    MainUtil.sendMessage(player, C.PLOT_CHAT_OFF);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    MainUtil.sendMessage(player, C.PLOT_CHAT_ON);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        if (BukkitMain.worldEdit != null) {
 | 
			
		||||
            toggles.put("worldedit", 
 | 
			
		||||
                new Command<PlotPlayer>("worldedit", "/plot toggle worldedit", "Toggle worldedit bypass", C.PERMISSION_WORLDEDIT_BYPASS.s()) {
 | 
			
		||||
                
 | 
			
		||||
                @Override
 | 
			
		||||
                public boolean onCommand(PlotPlayer player, String[] args) {
 | 
			
		||||
                    if (toggle(player, "worldedit")) {
 | 
			
		||||
                        MainUtil.sendMessage(player, C.WORLDEDIT_RESTRICTED);
 | 
			
		||||
                    }
 | 
			
		||||
                    else {
 | 
			
		||||
                        MainUtil.sendMessage(player, C.WORLDEDIT_UNMASKED);
 | 
			
		||||
                    }
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -49,20 +116,16 @@ public class Toggle extends SubCommand {
 | 
			
		||||
            noArgs(player);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        switch (args[0].toLowerCase()) {
 | 
			
		||||
            case "titles": {
 | 
			
		||||
                if (toggle(player, "disabletitles")) {
 | 
			
		||||
                    MainUtil.sendMessage(player, C.TOGGLE_ENABLED, args[0]);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    MainUtil.sendMessage(player, C.TOGGLE_DISABLED, args[0]);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            default: {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        Command<PlotPlayer> cmd = toggles.get(args[0].toLowerCase());
 | 
			
		||||
        if (cmd == null) {
 | 
			
		||||
            noArgs(player);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (!Permissions.hasPermission(player, cmd.getPermission())) {
 | 
			
		||||
            C.NO_PERMISSION.send(player, cmd.getPermission());
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        return cmd.onCommand(player, Arrays.copyOfRange(args, 1, args.length));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public boolean toggle(PlotPlayer player, String key) {
 | 
			
		||||
 
 | 
			
		||||
@@ -37,25 +37,13 @@ import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
        requiredType = RequiredType.NONE,
 | 
			
		||||
        category = CommandCategory.DEBUG
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@Deprecated
 | 
			
		||||
public class WE_Anywhere extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(PlotPlayer player, String[] arguments) {
 | 
			
		||||
        if (BukkitMain.worldEdit == null) {
 | 
			
		||||
            MainUtil.sendMessage(player, "&cWorldEdit is not enabled on this server");
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        if (Permissions.hasPermission(player, "plots.worldedit.bypass")) {
 | 
			
		||||
            if (WEManager.bypass.contains(player.getName())) {
 | 
			
		||||
                WEManager.bypass.remove(player.getName());
 | 
			
		||||
                MainUtil.sendMessage(player, C.WORLDEDIT_RESTRICTED);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                WEManager.bypass.add(player.getName());
 | 
			
		||||
                MainUtil.sendMessage(player, C.WORLDEDIT_UNMASKED);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
        return MainCommand.onCommand(player, "plot", new String[] {"toggle", "worldedit"});
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,45 @@ import com.plotsquared.general.commands.CommandCaller;
 | 
			
		||||
 */
 | 
			
		||||
public enum C {
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Static flags
 | 
			
		||||
     */
 | 
			
		||||
    FLAG_USE("use","static.flags"),
 | 
			
		||||
    FLAG_PLACE("place","static.flags"),
 | 
			
		||||
    FLAG_PVP("pvp","static.flags"),
 | 
			
		||||
    FLAG_HANGING_PLACE("hanging-place","static.flags"),
 | 
			
		||||
    FLAG_HANGING_BREAK("hanging-break","static.flags"),
 | 
			
		||||
    FLAG_HOSTILE_INTERACT("hostile-interact","static.flags"),
 | 
			
		||||
    FLAG_ANIMAL_INTERACT("animal-interact","static.flags"),
 | 
			
		||||
    FLAG_VEHICLE_USE("vehicle-use","static.flags"),
 | 
			
		||||
    FLAG_PLAYER_INTERACT("player-interact","static.flags"),
 | 
			
		||||
    FLAG_TAMED_INTERACT("tamed-interact","static.flags"),
 | 
			
		||||
    FLAG_DISABLE_PHYSICS("disable-physics","static.flags"),
 | 
			
		||||
    /*
 | 
			
		||||
     * Static permission
 | 
			
		||||
     */
 | 
			
		||||
    PERMISSION_STAR("*","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN("plots.admin","static.permissions"),
 | 
			
		||||
    PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned","static.permissions"),
 | 
			
		||||
    PERMISSION_PROJECTILE_OTHER("plots.projectile.other","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS("plots.admin.interact.blockedcommands","static.permissions"),
 | 
			
		||||
    PERMISSION_WORLDEDIT_BYPASS("plots.worldedit.bypass","static.permissions"),
 | 
			
		||||
    PERMISSION_PLOT_TOGGLE_TITLES("plots.toggle.titles","static.permissions"),
 | 
			
		||||
    PERMISSION_PLOT_TOGGLE_CHAT("plots.toggle.chat","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_EXIT_DENIED("plots.admin.exit.denied","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied","static.permissions"),
 | 
			
		||||
    PERMISSION_COMMANDS_CHAT("plots.admin.command.chat","static.permissions"),
 | 
			
		||||
    PERMISSION_MERGE_OTHER("plots.merge.other","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_DESTROY_OTHER( "plots.admin.destroy.other","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_DESTROY_ROAD("plots.admin.destroy.road","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_BUILD_ROAD("plots.admin.build.road","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_BUILD_UNOWNED("plots.admin.build.unowned","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other","static.permissions"),
 | 
			
		||||
    PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit","static.permissions"),
 | 
			
		||||
    /*
 | 
			
		||||
     * Confirm
 | 
			
		||||
     */
 | 
			
		||||
@@ -108,6 +147,7 @@ public enum C {
 | 
			
		||||
    WORLDEDIT_ITERATIONS("$2You cannot iterate %current% times. The maximum number of iterations allowed is %max%.", "WorldEdit Masks"),
 | 
			
		||||
    WORLDEDIT_UNSAFE("$2Access to that command has been blocked", "WorldEdit Masks"),
 | 
			
		||||
    WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea", "WorldEdit Masks"),
 | 
			
		||||
    WORLDEDIT_BYPASSED("$2Currently bypassing WorldEdit restriction.", "WorldEdit Masks"),
 | 
			
		||||
    WORLDEDIT_UNMASKED("$1Your WorldEdit is now unrestricted.", "WorldEdit Masks"),
 | 
			
		||||
    WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted.", "WorldEdit Masks"),
 | 
			
		||||
 | 
			
		||||
@@ -581,6 +621,11 @@ public enum C {
 | 
			
		||||
        this(d, true, cat.toLowerCase());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString() {
 | 
			
		||||
        return s;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static String format(String m, Object... args) {
 | 
			
		||||
        if (args.length == 0) {
 | 
			
		||||
            return m;
 | 
			
		||||
@@ -638,6 +683,9 @@ public enum C {
 | 
			
		||||
                String node = split[split.length - 1].toUpperCase();
 | 
			
		||||
                C caption = allNames.contains(node) ? valueOf(node) : null;
 | 
			
		||||
                if (caption != null) {
 | 
			
		||||
                    if (caption.cat.startsWith("static")) {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    String value = yml.getString(key);
 | 
			
		||||
                    if (!split[0].equalsIgnoreCase(caption.cat)) {
 | 
			
		||||
                        changed = true;
 | 
			
		||||
@@ -670,6 +718,9 @@ public enum C {
 | 
			
		||||
            replacements.put("&-", "\n");
 | 
			
		||||
            for (C caption : all) {
 | 
			
		||||
                if (!captions.contains(caption)) {
 | 
			
		||||
                    if (caption.cat.startsWith("static")) {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    changed = true;
 | 
			
		||||
                    yml.set(caption.cat + "." + caption.name().toLowerCase(), caption.d);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -115,6 +115,10 @@ public class Settings {
 | 
			
		||||
     * Schematic Save Path
 | 
			
		||||
     */
 | 
			
		||||
    public static String SCHEMATIC_SAVE_PATH = "/var/www/schematics";
 | 
			
		||||
    /**
 | 
			
		||||
     * BO3 Save Path
 | 
			
		||||
     */
 | 
			
		||||
    public static String BO3_SAVE_PATH = "BO3";
 | 
			
		||||
    /**
 | 
			
		||||
     * Max allowed plots
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ import com.intellectualcrafters.plot.util.SetBlockQueue;
 | 
			
		||||
/**
 | 
			
		||||
 * A plot manager with square plots which tesselate on a square grid with the following sections: ROAD, WALL, BORDER (wall), PLOT, FLOOR (plot)
 | 
			
		||||
 */
 | 
			
		||||
public abstract class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean setComponent(final PlotWorld plotworld, final PlotId plotid, final String component, final PlotBlock[] blocks) {
 | 
			
		||||
        switch (component) {
 | 
			
		||||
@@ -34,6 +34,17 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean unclaimPlot(PlotWorld plotworld, Plot plot, Runnable whenDone) {
 | 
			
		||||
        final HybridPlotWorld dpw = ((HybridPlotWorld) plotworld);
 | 
			
		||||
        setWallFilling(dpw, plot.id, new PlotBlock[] { dpw.WALL_FILLING });
 | 
			
		||||
        if (dpw.WALL_BLOCK.id != 0 || !dpw.WALL_BLOCK.equals(dpw.CLAIMED_WALL_BLOCK)) {
 | 
			
		||||
            setWall(dpw, plot.id, new PlotBlock[] { dpw.WALL_BLOCK });
 | 
			
		||||
        }
 | 
			
		||||
        SetBlockQueue.addNotify(whenDone);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public boolean setFloor(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
 | 
			
		||||
        final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
 | 
			
		||||
        final Location pos1 = MainUtil.getPlotBottomLoc(plotworld.worldname, plotid).add(1, 0, 1);
 | 
			
		||||
 
 | 
			
		||||
@@ -167,7 +167,7 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
     * to have 512x512 sized plots
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean clearPlot(final PlotWorld plotworld, final Plot plot, final boolean isDelete, final Runnable whenDone) {
 | 
			
		||||
    public boolean clearPlot(final PlotWorld plotworld, final Plot plot, final Runnable whenDone) {
 | 
			
		||||
        final String world = plotworld.worldname;
 | 
			
		||||
        final HybridPlotWorld dpw = ((HybridPlotWorld) plotworld);
 | 
			
		||||
        
 | 
			
		||||
@@ -181,8 +181,6 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
        final PlotBlock[] bedrock = (dpw.PLOT_BEDROCK ? new PlotBlock[] { new PlotBlock((short) 7, (byte) 0) } : filling);
 | 
			
		||||
        final PlotBlock air = new PlotBlock((short) 0, (byte) 0);
 | 
			
		||||
        
 | 
			
		||||
        setWallFilling(dpw, plot.id, new PlotBlock[] { dpw.WALL_FILLING });
 | 
			
		||||
        
 | 
			
		||||
        ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
@@ -216,11 +214,6 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
        }, new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                // When we are done with the inside of the plot, we can reset the wall / border
 | 
			
		||||
                final PlotBlock wall = isDelete ? dpw.WALL_BLOCK : dpw.CLAIMED_WALL_BLOCK;
 | 
			
		||||
                if (wall.id != 0 || !dpw.WALL_BLOCK.equals(dpw.CLAIMED_WALL_BLOCK)) {
 | 
			
		||||
                    setWall(dpw, plot.id, new PlotBlock[] { wall });
 | 
			
		||||
                }
 | 
			
		||||
                // And notify whatever called this when plot clearing is done
 | 
			
		||||
                SetBlockQueue.addNotify(whenDone);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
 */
 | 
			
		||||
public abstract class SquarePlotManager extends GridPlotManager {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean clearPlot(final PlotWorld plotworld, final Plot plot, final boolean isDelete, final Runnable whenDone) {
 | 
			
		||||
    public boolean clearPlot(final PlotWorld plotworld, final Plot plot, final Runnable whenDone) {
 | 
			
		||||
        final Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
 | 
			
		||||
        final Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);
 | 
			
		||||
        ChunkManager.manager.regenerateRegion(pos1, pos2, whenDone);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										46
									
								
								src/main/java/com/intellectualcrafters/plot/object/BO3.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/main/java/com/intellectualcrafters/plot/object/BO3.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
package com.intellectualcrafters.plot.object;
 | 
			
		||||
 | 
			
		||||
public class BO3 {
 | 
			
		||||
    private final ChunkLoc chunk;
 | 
			
		||||
    private final StringBuilder blocks;
 | 
			
		||||
    private final StringBuilder children;
 | 
			
		||||
    private final String name;
 | 
			
		||||
    
 | 
			
		||||
    public BO3(String name, ChunkLoc loc) {
 | 
			
		||||
        this.name = name;
 | 
			
		||||
        this.chunk = loc;
 | 
			
		||||
        this.blocks = new StringBuilder();
 | 
			
		||||
        this.children = new StringBuilder();
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public void addChild(BO3 child) {
 | 
			
		||||
        ChunkLoc childloc = child.getLoc();
 | 
			
		||||
        children.append("Branch(" + (childloc.x - chunk.x) + ",0," + (childloc.z - chunk.z) + "," + name + "_" + childloc.x + "_" + childloc.z + ")\n");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public ChunkLoc getLoc() {
 | 
			
		||||
        return this.chunk;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void addBlock(int x, int y, int z, PlotBlock block) {
 | 
			
		||||
        if (block.data == 0) {
 | 
			
		||||
            // Block(-3,1,-2,AIR)
 | 
			
		||||
            blocks.append("Block(" + x + "," + y + "," + z + "," + block.id + ")\n");
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            blocks.append("Block(" + x + "," + y + "," + z + "," + block.id + ":" + block.data + ")\n");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getBlocks() {
 | 
			
		||||
        return blocks.toString();
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public String getChildren() {
 | 
			
		||||
        return children.toString();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -20,6 +20,8 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.object;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.net.URL;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
@@ -28,13 +30,18 @@ import java.util.Map.Entry;
 | 
			
		||||
import java.util.concurrent.ConcurrentHashMap;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.jnbt.CompoundTag;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Configuration;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.Flag;
 | 
			
		||||
import com.intellectualcrafters.plot.util.BO3Handler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.BlockManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.ChunkManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SchematicHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -717,6 +724,71 @@ public class Plot {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Export the plot as a schematic to the configured output directory
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public void export(final RunnableVal<Boolean> whenDone) {
 | 
			
		||||
        SchematicHandler.manager.getCompoundTag(world, id, new RunnableVal<CompoundTag>() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                if (value == null) {
 | 
			
		||||
                    if (whenDone != null) {
 | 
			
		||||
                        whenDone.value = false; 
 | 
			
		||||
                        TaskManager.runTask(whenDone);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    TaskManager.runTaskAsync(new Runnable() {
 | 
			
		||||
                        @Override
 | 
			
		||||
                        public void run() {
 | 
			
		||||
                            String name = id+ "," + world + "," + MainUtil.getName(owner);
 | 
			
		||||
                            final boolean result = SchematicHandler.manager.save(value, Settings.SCHEMATIC_SAVE_PATH + File.separator + name + ".schematic");
 | 
			
		||||
                            if (whenDone != null) {
 | 
			
		||||
                                whenDone.value = result; 
 | 
			
		||||
                                TaskManager.runTask(whenDone);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Export the plot as a BO3 object
 | 
			
		||||
     * @param whenDone value will be false if exporting fails
 | 
			
		||||
     */
 | 
			
		||||
    public void exportBO3(final RunnableVal<Boolean> whenDone) {
 | 
			
		||||
        boolean result = BO3Handler.saveBO3(this);
 | 
			
		||||
        if (whenDone != null) {
 | 
			
		||||
            whenDone.value = result;
 | 
			
		||||
        }
 | 
			
		||||
        TaskManager.runTask(whenDone);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Upload the plot to the configured web interface 
 | 
			
		||||
     * @param whenDone value will be null if uploading fails
 | 
			
		||||
     */
 | 
			
		||||
    public void upload(final RunnableVal<URL> whenDone) {
 | 
			
		||||
        SchematicHandler.manager.getCompoundTag(world, id, new RunnableVal<CompoundTag>() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                TaskManager.runTaskAsync(new Runnable() {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public void run() {
 | 
			
		||||
                        URL url = SchematicHandler.manager.upload(value, null, null);
 | 
			
		||||
                        if (whenDone != null) {
 | 
			
		||||
                            whenDone.value = url;
 | 
			
		||||
                        }
 | 
			
		||||
                        TaskManager.runTask(whenDone);
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean equals(final Object obj) {
 | 
			
		||||
        if (this == obj) {
 | 
			
		||||
 
 | 
			
		||||
@@ -45,9 +45,11 @@ public abstract class PlotManager {
 | 
			
		||||
    /*
 | 
			
		||||
     * Plot clearing (return false if you do not support some method)
 | 
			
		||||
     */
 | 
			
		||||
    public abstract boolean clearPlot(final PlotWorld plotworld, final Plot plot, boolean isDelete, Runnable whenDone);
 | 
			
		||||
    public abstract boolean clearPlot(final PlotWorld plotworld, final Plot plot, Runnable whenDone);
 | 
			
		||||
 | 
			
		||||
    public abstract boolean claimPlot(final PlotWorld plotworld, final Plot plot);
 | 
			
		||||
    
 | 
			
		||||
    public abstract boolean unclaimPlot(final PlotWorld plotworld, final Plot plot, Runnable whenDone);
 | 
			
		||||
 | 
			
		||||
    public abstract Location getSignLoc(final PlotWorld plotworld, final Plot plot);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -176,8 +176,12 @@ public abstract class PlotPlayer implements CommandCaller {
 | 
			
		||||
    public abstract Location getLocationFull();
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the player's UUID
 | 
			
		||||
     * @return
 | 
			
		||||
     * Get the player's UUID<br>
 | 
			
		||||
     *  === !IMPORTANT ===<br> 
 | 
			
		||||
     *  The UUID is dependent on the mode chosen in the settings.yml and may not be the same as Bukkit has 
 | 
			
		||||
     *  (especially if using an old version of Bukkit that does not support UUIDs)
 | 
			
		||||
     *  
 | 
			
		||||
     * @return UUID
 | 
			
		||||
     */
 | 
			
		||||
    public abstract UUID getUUID();
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -1,70 +0,0 @@
 | 
			
		||||
package com.intellectualcrafters.plot.object;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@SuppressWarnings({"unused"})
 | 
			
		||||
public class StaticStrings {
 | 
			
		||||
 | 
			
		||||
    public static final String
 | 
			
		||||
        PERMISSION_ADMIN = "plots.admin",
 | 
			
		||||
        PERMISSION_PROJECTILE_UNOWNED = "plots.projectile.unowned",
 | 
			
		||||
        PERMISSION_PROJECTILE_OTHER = "plots.projectile.other",
 | 
			
		||||
        PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS = "plots.admin.interact.blockedcommands",
 | 
			
		||||
        PERMISSION_WORLDEDIT_BYPASS = "plots.worldedit.bypass",
 | 
			
		||||
        PERMISSION_ADMIN_EXIT_DENIED = "plots.admin.exit.denied",
 | 
			
		||||
        PERMISSION_ADMIN_ENTRY_DENIED = "plots.admin.entry.denied",
 | 
			
		||||
        PERMISSION_COMMANDS_CHAT = "plots.admin.command.chat",
 | 
			
		||||
        PERMISSION_ADMIN_DESTROY_UNOWNED = "plots.admin.destroy.unowned",
 | 
			
		||||
        PERMISSION_ADMIN_DESTROY_OTHER =  "plots.admin.destroy.other",
 | 
			
		||||
        PERMISSION_ADMIN_DESTROY_ROAD = "plots.admin.destroy.road",
 | 
			
		||||
        PERMISSION_ADMIN_BUILD_ROAD = "plots.admin.build.road",
 | 
			
		||||
        PERMISSION_ADMIN_BUILD_UNOWNED = "plots.admin.build.unowned",
 | 
			
		||||
        PERMISSION_ADMIN_BUILD_OTHER = "plots.admin.build.other",
 | 
			
		||||
        PERMISSION_ADMIN_INTERACT_ROAD = "plots.admin.interact.road",
 | 
			
		||||
        PERMISSION_ADMIN_INTERACT_UNOWNED = "plots.admin.interact.unowned",
 | 
			
		||||
        PERMISSION_ADMIN_INTERACT_OTHER = "plots.admin.interact.other",
 | 
			
		||||
        PERMISSION_ADMIN_BUILD_HEIGHTLIMIT = "plots.admin.build.heightlimit";
 | 
			
		||||
 | 
			
		||||
    public static final String
 | 
			
		||||
        FLAG_USE = "use",
 | 
			
		||||
        FLAG_PLACE = "place",
 | 
			
		||||
        FLAG_PVP = "pvp",
 | 
			
		||||
        FLAG_HANGING_PLACE = "hanging-place",
 | 
			
		||||
        FLAG_HANGING_BREAK = "hanging-break",
 | 
			
		||||
        FLAG_HOSTILE_INTERACT = "hostile-interact",
 | 
			
		||||
        FLAG_ANIMAL_INTERACT = "animal-interact",
 | 
			
		||||
        FLAG_VEHICLE_USE = "vehicle-use",
 | 
			
		||||
        FLAG_TAMED_INTERACT = "tamed-interact",
 | 
			
		||||
        FLAG_DISABLE_PHYSICS = "disable-physics";
 | 
			
		||||
 | 
			
		||||
    public static final String
 | 
			
		||||
        META_INVENTORY = "inventory";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static final String
 | 
			
		||||
        PREFIX_META = "META_",
 | 
			
		||||
        PREFIX_FLAG = "FLAG_",
 | 
			
		||||
        PREFIX_PERMISSION = "PERMISSION_";
 | 
			
		||||
 | 
			
		||||
    public static Map<String, String> getStrings(final String prefix) {
 | 
			
		||||
        final Field[] fields = StaticStrings.class.getDeclaredFields();
 | 
			
		||||
        Map<String, String> strings = new HashMap<>();
 | 
			
		||||
        for (final Field field : fields) {
 | 
			
		||||
            if (field.getGenericType() != String.class) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            if (field.getName().startsWith(prefix)) {
 | 
			
		||||
                field.setAccessible(true);
 | 
			
		||||
                try {
 | 
			
		||||
                    String value = field.get(StaticStrings.class).toString();
 | 
			
		||||
                    strings.put(field.getName(), value);
 | 
			
		||||
                } catch (IllegalAccessException e) {
 | 
			
		||||
                    e.printStackTrace();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return strings;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										160
									
								
								src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										160
									
								
								src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,160 @@
 | 
			
		||||
package com.intellectualcrafters.plot.util;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.nio.file.Files;
 | 
			
		||||
import java.nio.file.StandardOpenOption;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.object.BO3;
 | 
			
		||||
import com.intellectualcrafters.plot.object.ChunkLoc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotBlock;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
 | 
			
		||||
 | 
			
		||||
public class BO3Handler {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @see #saveBO3(null, Plot)
 | 
			
		||||
     * @param plot
 | 
			
		||||
     * @return if successfully exported 
 | 
			
		||||
     */
 | 
			
		||||
    public static boolean saveBO3(Plot plot) {
 | 
			
		||||
        return saveBO3(null, plot);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Save a plot as a BO3 file<br>
 | 
			
		||||
     *  - Use null for the player object if no player is applicable
 | 
			
		||||
     * @param plr
 | 
			
		||||
     * @param plot
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static boolean saveBO3(PlotPlayer plr, Plot plot) {
 | 
			
		||||
        PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
 | 
			
		||||
        if (!(plotworld instanceof ClassicPlotWorld) || plotworld.TYPE != 0) {
 | 
			
		||||
            MainUtil.sendMessage(plr, "BO3 exporting only supports type 0 classic generation.");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        String alias = plot.toString();
 | 
			
		||||
        Location pos1 = plot.getBottom().add(1, 0, 1);
 | 
			
		||||
        Location pos2 = plot.getTop();
 | 
			
		||||
        ClassicPlotWorld cpw = (ClassicPlotWorld) plotworld;
 | 
			
		||||
        int height = cpw.PLOT_HEIGHT;
 | 
			
		||||
        
 | 
			
		||||
        int cx = (pos1.getX() + pos2.getX()) / 2;
 | 
			
		||||
        int cz = (pos1.getZ() + pos2.getZ()) / 2;
 | 
			
		||||
        
 | 
			
		||||
        HashMap<ChunkLoc, BO3> map = new HashMap<>();
 | 
			
		||||
        
 | 
			
		||||
        boolean content = false;
 | 
			
		||||
        for (int x = pos1.getX(); x <= pos2.getX(); x++) {
 | 
			
		||||
            int X = ((x + 7) - cx) >> 4;
 | 
			
		||||
            int xx = (x - cx) % 16;
 | 
			
		||||
            for (int z = pos1.getZ(); z <= pos2.getZ(); z++) {
 | 
			
		||||
                int Z = ((z + 7) - cz) >> 4;
 | 
			
		||||
                int zz = (z - cz) % 16;
 | 
			
		||||
                ChunkLoc loc = new ChunkLoc(X, Z);
 | 
			
		||||
                BO3 bo3 = map.get(loc);
 | 
			
		||||
                for (int y = height + 1; y < 256; y++) {
 | 
			
		||||
                    PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
 | 
			
		||||
                    if (block != null && block.id != 0) {
 | 
			
		||||
                        if (bo3 == null) {
 | 
			
		||||
                            bo3 = new BO3(alias, loc);
 | 
			
		||||
                            map.put(loc, bo3);
 | 
			
		||||
                            content = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        bo3.addBlock(xx, y - height - 1, zz, block);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if (!content) {
 | 
			
		||||
            MainUtil.sendMessage(plr, "No content found!");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        for (Entry<ChunkLoc, BO3> entry : map.entrySet()) {
 | 
			
		||||
            ChunkLoc chunk = entry.getKey();
 | 
			
		||||
            BO3 bo3 = entry.getValue();
 | 
			
		||||
            if (chunk.x == 0 && chunk.z == 0) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            int x = chunk.x;
 | 
			
		||||
            int z = chunk.z;
 | 
			
		||||
            if (Math.abs(chunk.x) > Math.abs(chunk.z)) {
 | 
			
		||||
                x += chunk.x > 0 ? -1 : 1;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                z += chunk.z > 0 ? -1 : 1;
 | 
			
		||||
            }
 | 
			
		||||
            ChunkLoc parentLoc = new ChunkLoc(x, z);
 | 
			
		||||
            if (!map.containsKey(parentLoc)) {
 | 
			
		||||
                parentLoc = null;
 | 
			
		||||
                for (Entry<ChunkLoc, BO3> entry2 : map.entrySet()) {
 | 
			
		||||
                    ChunkLoc other = entry2.getKey();
 | 
			
		||||
                    if ((other.x == chunk.x - 1 && other.z == chunk.z) || (other.z == chunk.z - 1 && other.x == chunk.x)) {
 | 
			
		||||
                        parentLoc = other;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                if (parentLoc == null) {
 | 
			
		||||
                    MainUtil.sendMessage(plr, "Exporting BO3 cancelled due to detached chunk: " + chunk + " - Make sure you only have one object per plot");
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            map.get(parentLoc).addChild(bo3);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        for (Entry<ChunkLoc, BO3> entry : map.entrySet()) {
 | 
			
		||||
            save(plot, entry.getValue());
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        MainUtil.sendMessage(plr, "BO3 exporting was successful!");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean save(Plot plot, BO3 bo3) {
 | 
			
		||||
        File base = getBaseFile(plot.world);
 | 
			
		||||
        try {
 | 
			
		||||
            List<String> lines = Files.readAllLines(base.toPath(), StandardCharsets.UTF_8);
 | 
			
		||||
            for (int i = 0; i < lines.size(); i++) {
 | 
			
		||||
                String line = lines.get(i).trim();
 | 
			
		||||
                String result = StringMan.replaceAll(line, "%owner%", MainUtil.getName(plot.owner), "%alias%", plot.toString(), "%blocks%", bo3.getBlocks(), "%branches%", bo3.getChildren());
 | 
			
		||||
                if (!StringMan.isEqual(result, line)) {
 | 
			
		||||
                    lines.set(i, result);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            File bo3File;
 | 
			
		||||
            if (bo3.getLoc().x == 0 && bo3.getLoc().z == 0) {
 | 
			
		||||
                bo3File = new File(base.getParentFile(), bo3.getName() + ".bo3");
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                bo3File = new File(base.getParentFile(), bo3.getName() + "_" + bo3.getLoc().x + "_" + bo3.getLoc().z + ".bo3");
 | 
			
		||||
            }
 | 
			
		||||
            bo3File.createNewFile();
 | 
			
		||||
            Files.write(bo3File.toPath(), StringMan.join(lines, System.getProperty("line.separator")).getBytes(), StandardOpenOption.WRITE);
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static File getBaseFile(String category) {
 | 
			
		||||
        File base = new File(PS.get().IMP.getDirectory(), Settings.BO3_SAVE_PATH + File.separator + category + File.separator + "base.yml");
 | 
			
		||||
        if (!base.exists()) {
 | 
			
		||||
            PS.get().copyFile("base.yml", Settings.BO3_SAVE_PATH + File.separator + category);
 | 
			
		||||
        }
 | 
			
		||||
        return base;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -5,6 +5,7 @@ import java.util.HashSet;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.Flag;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.FlagManager;
 | 
			
		||||
import com.intellectualcrafters.plot.object.LazyBlock;
 | 
			
		||||
@@ -81,85 +82,85 @@ public abstract class EventUtil {
 | 
			
		||||
            }
 | 
			
		||||
            case BREAK_BLOCK: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "break");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case BREAK_HANGING:
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "hanging-break")) {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
                if (plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return Permissions.hasPermission(pp, Permissions.BREAK_UNOWNED.s, notifyPerms);
 | 
			
		||||
                return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED.s(), notifyPerms);
 | 
			
		||||
            case BREAK_MISC:
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "misc-break")) {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
                if (plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return Permissions.hasPermission(pp, Permissions.BREAK_UNOWNED.s, notifyPerms);
 | 
			
		||||
                return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED.s(), notifyPerms);
 | 
			
		||||
            case BREAK_VEHICLE:
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
                if (plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return Permissions.hasPermission(pp, Permissions.BREAK_UNOWNED.s, notifyPerms);
 | 
			
		||||
                return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED.s(), notifyPerms);
 | 
			
		||||
            case INTERACT_BLOCK: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "use");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case PLACE_BLOCK: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BUILD_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BUILD_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "place");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.BUILD_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case TRIGGER_PHYSICAL: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, false);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), false);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, false);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), false);
 | 
			
		||||
                }
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "device-interact")) {
 | 
			
		||||
                    return true;
 | 
			
		||||
@@ -167,16 +168,16 @@ public abstract class EventUtil {
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "use");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case INTERACT_HANGING: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "hanging-interact")) {
 | 
			
		||||
                    return true;
 | 
			
		||||
@@ -184,16 +185,16 @@ public abstract class EventUtil {
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "use");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case INTERACT_MISC: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "misc-interact")) {
 | 
			
		||||
                    return true;
 | 
			
		||||
@@ -201,16 +202,16 @@ public abstract class EventUtil {
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "use");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case INTERACT_VEHICLE: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_ROAD.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "vehicle-use")) {
 | 
			
		||||
                    return true;
 | 
			
		||||
@@ -218,16 +219,16 @@ public abstract class EventUtil {
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "use");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case SPAWN_MOB: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "mob-place")) {
 | 
			
		||||
@@ -236,16 +237,16 @@ public abstract class EventUtil {
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "place");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case PLACE_HANGING: {
 | 
			
		||||
//                if (plot == null) {
 | 
			
		||||
//                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
//                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
//                }
 | 
			
		||||
//                if (!plot.hasOwner()) {
 | 
			
		||||
//                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
 | 
			
		||||
//                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
			
		||||
//                }
 | 
			
		||||
//                
 | 
			
		||||
//                if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) {
 | 
			
		||||
@@ -254,16 +255,16 @@ public abstract class EventUtil {
 | 
			
		||||
//                Flag flag = FlagManager.getPlotFlag(plot, "place");
 | 
			
		||||
//                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
//                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
//                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
//                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
//                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case PLACE_MISC: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "misc-place")) {
 | 
			
		||||
@@ -272,16 +273,16 @@ public abstract class EventUtil {
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "place");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case PLACE_VEHICLE: {
 | 
			
		||||
                if (plot == null) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                if (!plot.hasOwner()) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                if (FlagManager.isPlotFlagTrue(plot, "vehicle-place")) {
 | 
			
		||||
@@ -290,7 +291,7 @@ public abstract class EventUtil {
 | 
			
		||||
                Flag flag = FlagManager.getPlotFlag(plot, "place");
 | 
			
		||||
                HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
 | 
			
		||||
                if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
 | 
			
		||||
                    return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
 | 
			
		||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -1033,25 +1033,30 @@ public class MainUtil {
 | 
			
		||||
        System.currentTimeMillis();
 | 
			
		||||
        final PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
 | 
			
		||||
        runners.put(plot, 1);
 | 
			
		||||
        if (plotworld.TERRAIN != 0 || Settings.FAST_CLEAR) {
 | 
			
		||||
            final Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);
 | 
			
		||||
            ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
 | 
			
		||||
                @Override
 | 
			
		||||
                public void run() {
 | 
			
		||||
                    runners.remove(plot);
 | 
			
		||||
                    TaskManager.runTask(whenDone);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        final Runnable run = new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                runners.remove(plot);
 | 
			
		||||
                TaskManager.runTask(whenDone);
 | 
			
		||||
                if (isDelete) {
 | 
			
		||||
                    manager.unclaimPlot(plotworld, plot, new Runnable() {
 | 
			
		||||
                        @Override
 | 
			
		||||
                        public void run() {
 | 
			
		||||
                            runners.remove(plot);
 | 
			
		||||
                            TaskManager.runTask(whenDone);
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    runners.remove(plot);
 | 
			
		||||
                    TaskManager.runTask(whenDone);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        manager.clearPlot(plotworld, plot, isDelete, run);
 | 
			
		||||
        if (plotworld.TERRAIN != 0 || Settings.FAST_CLEAR) {
 | 
			
		||||
            final Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);
 | 
			
		||||
            ChunkManager.manager.regenerateRegion(pos1, pos2, run);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        manager.clearPlot(plotworld, plot, run);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void setCuboid(final String world, final Location pos1, final Location pos2, final PlotBlock[] blocks) {
 | 
			
		||||
@@ -1647,6 +1652,29 @@ public class MainUtil {
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Send a message to the player
 | 
			
		||||
     *
 | 
			
		||||
     * @param plr Player to recieve message
 | 
			
		||||
     * @param c   Caption to send
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean success
 | 
			
		||||
     */
 | 
			
		||||
    public static boolean sendMessage(final PlotPlayer plr, final C c, final Object... args) {
 | 
			
		||||
        if (c.s().length() > 1) {
 | 
			
		||||
            String msg = c.s();
 | 
			
		||||
            if ((args != null) && (args.length > 0)) {
 | 
			
		||||
                msg = C.format(c, args);
 | 
			
		||||
            }
 | 
			
		||||
            if (plr == null) {
 | 
			
		||||
                PS.log(msg);
 | 
			
		||||
            } else {
 | 
			
		||||
                sendMessage(plr, msg, c.usePrefix());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static Plot getBottomPlot(final Plot plot) {
 | 
			
		||||
        if (plot.getSettings().getMerged(0)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,41 +2,19 @@ package com.intellectualcrafters.plot.util;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.general.commands.CommandCaller;
 | 
			
		||||
 | 
			
		||||
public enum Permissions {
 | 
			
		||||
    // ADMIN
 | 
			
		||||
    ADMIN("plots.admin", "do-not-change"),
 | 
			
		||||
    STAR("*", "do-not-change"),
 | 
			
		||||
    // BUILD
 | 
			
		||||
    BUILD_OTHER("plots.admin.build.other", "build"),
 | 
			
		||||
    BUILD_ROAD("plots.admin.build.road", "build"),
 | 
			
		||||
    BUILD_UNOWNED("plots.admin.build.unowned", "build"),
 | 
			
		||||
    // INTERACT
 | 
			
		||||
    INTERACT_OTHER("plots.admin.interact.other", "interact"),
 | 
			
		||||
    INTERACT_ROAD("plots.admin.interact.road", "interact"),
 | 
			
		||||
    INTERACT_UNOWNED("plots.admin.interact.unowned", "interact"),
 | 
			
		||||
    // BREAK
 | 
			
		||||
    BREAK_OTHER("plots.admin.break.other", "break"),
 | 
			
		||||
    BREAK_ROAD("plots.admin.break.road", "break"),
 | 
			
		||||
    BREAK_UNOWNED("plots.admin.break.unowned", "break"),
 | 
			
		||||
    // MERGE
 | 
			
		||||
    MERGE_OTHER("plots.merge.other", "merge");
 | 
			
		||||
    
 | 
			
		||||
    public String s;
 | 
			
		||||
    public String cat;
 | 
			
		||||
    
 | 
			
		||||
    Permissions(String perm, String cat) {
 | 
			
		||||
        this.s = perm;
 | 
			
		||||
        this.cat = cat;
 | 
			
		||||
public class Permissions {
 | 
			
		||||
    public static boolean hasPermission(final PlotPlayer player, final C c) {
 | 
			
		||||
        return hasPermission(player, c.s());
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean hasPermission(final PlotPlayer player, final Permissions perm) {
 | 
			
		||||
        return hasPermission(player, perm.s);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static boolean hasPermission(final PlotPlayer player, final String perm) {
 | 
			
		||||
        if ((player == null) || player.hasPermission(ADMIN.s) || player.hasPermission(STAR.s)) {
 | 
			
		||||
        return hasPermission((CommandCaller) player, perm);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static boolean hasPermission(final CommandCaller player, final String perm) {
 | 
			
		||||
        if ((player == null) || player.hasPermission(C.PERMISSION_ADMIN.s()) || player.hasPermission(C.PERMISSION_STAR.s())) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        if (player.hasPermission(perm)) {
 | 
			
		||||
@@ -46,7 +24,7 @@ public enum Permissions {
 | 
			
		||||
        final StringBuilder n = new StringBuilder();
 | 
			
		||||
        for (int i = 0; i < (nodes.length - 1); i++) {
 | 
			
		||||
            n.append(nodes[i] + ("."));
 | 
			
		||||
            if (player.hasPermission(n + STAR.s)) {
 | 
			
		||||
            if (player.hasPermission(n + C.PERMISSION_STAR.s())) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -64,7 +42,7 @@ public enum Permissions {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) {
 | 
			
		||||
        if ((player == null) || player.hasPermission(ADMIN.s) || player.hasPermission(STAR.s)) {
 | 
			
		||||
        if ((player == null) || player.hasPermission(C.PERMISSION_ADMIN.s()) || player.hasPermission(C.PERMISSION_STAR.s())) {
 | 
			
		||||
            return Integer.MAX_VALUE;
 | 
			
		||||
        }
 | 
			
		||||
        if (player.hasPermission(stub + ".*")) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user