mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	commit
This commit is contained in:
		@@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
@@ -44,7 +44,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
        usage = "/plot add <player>",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        permission = "plots.add",
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Add extends SubCommand {
 | 
			
		||||
 | 
			
		||||
@@ -55,8 +55,7 @@ public class Add extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -34,13 +34,13 @@ import com.intellectualcrafters.plot.util.EconHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "auto",
 | 
			
		||||
        permission = "plots.auto",
 | 
			
		||||
        category = CommandCategory.CLAIMING,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        description = "Claim the nearest plot",
 | 
			
		||||
        aliases = {"a"},
 | 
			
		||||
        usage = "/plot auto"
 | 
			
		||||
@@ -77,8 +77,8 @@ public class Auto extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        String world;
 | 
			
		||||
        int size_x = 1;
 | 
			
		||||
        int size_z = 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.util.EconHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "buy",
 | 
			
		||||
@@ -45,13 +45,13 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        usage = "/plot buy",
 | 
			
		||||
        permission = "plots.buy",
 | 
			
		||||
        category = CommandCategory.CLAIMING,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Buy extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        
 | 
			
		||||
        if (EconHandler.manager == null) {
 | 
			
		||||
            return sendMessage(plr, C.ECON_DISABLED);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotWorld;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "chat",
 | 
			
		||||
@@ -13,13 +13,13 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        usage = "/plot chat [on|off]",
 | 
			
		||||
        permission = "plots.chat",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Chat extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    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);
 | 
			
		||||
 
 | 
			
		||||
@@ -35,14 +35,14 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SchematicHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "claim",
 | 
			
		||||
        aliases = {"c"},
 | 
			
		||||
        description = "Claim the current plot you're standing on",
 | 
			
		||||
        category = CommandCategory.CLAIMING,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        permission = "plots.claim",
 | 
			
		||||
        usage = "/plot claim"
 | 
			
		||||
)
 | 
			
		||||
@@ -96,8 +96,8 @@ public class Claim extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        
 | 
			
		||||
        String schematic = "";
 | 
			
		||||
        if (args.length >= 1) {
 | 
			
		||||
            schematic = args[0];
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
@@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "clear",
 | 
			
		||||
@@ -48,39 +48,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class Clear extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
        if (plr == null) {
 | 
			
		||||
            // Is console
 | 
			
		||||
            if (args.length < 2) {
 | 
			
		||||
                PS.log("You need to specify two arguments: ID (0;0) & World (world)");
 | 
			
		||||
            } else {
 | 
			
		||||
                final PlotId id = PlotId.fromString(args[0]);
 | 
			
		||||
                final String world = args[1];
 | 
			
		||||
                if (id == null) {
 | 
			
		||||
                    PS.log("Invalid Plot ID: " + args[0]);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (!PS.get().isPlotWorld(world)) {
 | 
			
		||||
                        PS.log("Invalid plot world: " + world);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        final Plot plot = MainUtil.getPlot(world, id);
 | 
			
		||||
                        if (plot == null) {
 | 
			
		||||
                            PS.log("Could not find plot " + args[0] + " in world " + world);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            Runnable runnable = new Runnable() {
 | 
			
		||||
                                @Override
 | 
			
		||||
                                public void run() {
 | 
			
		||||
                                    MainUtil.clear(plot, plot.owner == null, null);
 | 
			
		||||
                                    PS.log("Plot " + plot.getId().toString() + " cleared.");
 | 
			
		||||
                                }
 | 
			
		||||
                            };
 | 
			
		||||
                            TaskManager.runTask(runnable);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot;
 | 
			
		||||
        if (args.length == 2) {
 | 
			
		||||
 
 | 
			
		||||
@@ -29,12 +29,6 @@ import org.bukkit.generator.ChunkGenerator;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.PlotGenerator;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.plotsquared.bukkit.generator.AugmentedPopulator;
 | 
			
		||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
 | 
			
		||||
import com.plotsquared.bukkit.generator.HybridGen;
 | 
			
		||||
import com.intellectualcrafters.plot.object.BlockLoc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
@@ -48,21 +42,25 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.plotsquared.bukkit.generator.AugmentedPopulator;
 | 
			
		||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
 | 
			
		||||
import com.plotsquared.bukkit.generator.HybridGen;
 | 
			
		||||
import com.plotsquared.bukkit.util.SetupUtils;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "cluser",
 | 
			
		||||
        aliases = {"clusters"},
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        permission = "plots.cluster",
 | 
			
		||||
        description = "Manage a plot cluster"
 | 
			
		||||
)
 | 
			
		||||
public class Cluster extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        
 | 
			
		||||
        // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
 | 
			
		||||
        if (args.length == 0) {
 | 
			
		||||
            // return arguments
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
@@ -41,14 +41,13 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
        aliases = {"msg"},
 | 
			
		||||
        description = "Comment on a plot",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        permission = "plot.comment"
 | 
			
		||||
)
 | 
			
		||||
public class Comment extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(PlotPlayer player, String[] args) {
 | 
			
		||||
        if (args.length < 2) {
 | 
			
		||||
            sendMessage(player, C.COMMENT_SYNTAX, StringUtils.join(CommentManager.inboxes.keySet(),"|"));
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
@@ -43,7 +43,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
        permission = "plots.admin",
 | 
			
		||||
        description = "Condense a plotworld",
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        requiredType = PS.class
 | 
			
		||||
        requiredType = RequiredType.CONSOLE
 | 
			
		||||
)
 | 
			
		||||
public class Condense extends SubCommand {
 | 
			
		||||
 | 
			
		||||
@@ -54,8 +54,7 @@ public class Condense extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, String ... args) {
 | 
			
		||||
        final PlotPlayer plr = null;
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, String ... args) {
 | 
			
		||||
        if ((args.length != 2) && (args.length != 3)) {
 | 
			
		||||
            MainUtil.sendMessage(plr, "/plot condense <world> <start|stop|info> [radius]");
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.CmdInstance;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
@@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.util.CmdConfirm;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
		command = "confirm",
 | 
			
		||||
@@ -39,8 +39,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class Confirm extends SubCommand {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
		final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
	public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
    	CmdInstance command = CmdConfirm.getPending(plr);
 | 
			
		||||
    	if (command == null) {
 | 
			
		||||
    		MainUtil.sendMessage(plr, C.FAILED_CONFIRM);
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "copy",
 | 
			
		||||
@@ -38,7 +38,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        description = "Copy a plot",
 | 
			
		||||
        usage = "/plot copy <X;Z>",
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Copy extends SubCommand {
 | 
			
		||||
 | 
			
		||||
@@ -49,8 +49,7 @@ public class Copy extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot1 = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot1 == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -29,13 +29,13 @@ import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "createroadschematic",
 | 
			
		||||
        aliases = {"crs"},
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        permission = "plots.createroadschematic",
 | 
			
		||||
        description = "Add a road schematic to your world using the roads around your current plot",
 | 
			
		||||
        usage = "/plot createroadschematic"
 | 
			
		||||
@@ -43,8 +43,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class CreateRoadSchematic extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String ... args) {
 | 
			
		||||
        final Location loc = player.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import java.util.ArrayList;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.database.MySQL;
 | 
			
		||||
import com.intellectualcrafters.plot.database.SQLManager;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
@@ -16,7 +16,7 @@ import com.intellectualcrafters.plot.util.StringComparison;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "database",
 | 
			
		||||
@@ -24,7 +24,9 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        permission = "plots.database",
 | 
			
		||||
        description = "Convert/Backup Storage",
 | 
			
		||||
        requiredType = RequiredType.CONSOLE,
 | 
			
		||||
        usage = "/plots database <type> [details...]"
 | 
			
		||||
        
 | 
			
		||||
)
 | 
			
		||||
public class Database extends SubCommand {
 | 
			
		||||
 | 
			
		||||
@@ -73,8 +75,7 @@ public class Database extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        if (args.length < 1) {
 | 
			
		||||
            return sendMessage(plr, "/plot database [sqlite/mysql]");
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -21,13 +21,13 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Lag;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "debug",
 | 
			
		||||
@@ -39,8 +39,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class Debug extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
 | 
			
		||||
            final StringBuilder msg = new StringBuilder();
 | 
			
		||||
            for (final C c : C.values()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,14 +9,14 @@ import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "debugallowunsafe",
 | 
			
		||||
        description = "Allow unsafe actions until toggled off",
 | 
			
		||||
        usage = "/plot debugallowunsafe",
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        permission = "plots.debugallowunsafe"
 | 
			
		||||
)
 | 
			
		||||
public class DebugAllowUnsafe extends SubCommand {
 | 
			
		||||
@@ -24,8 +24,8 @@ public class DebugAllowUnsafe extends SubCommand {
 | 
			
		||||
    public static final List<UUID> unsafeAllowed = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        
 | 
			
		||||
        if (unsafeAllowed.contains(plr.getUUID())) {
 | 
			
		||||
            unsafeAllowed.remove(plr.getUUID());
 | 
			
		||||
            sendMessage(plr, C.DEBUGALLOWUNSAFE_OFF);
 | 
			
		||||
 
 | 
			
		||||
@@ -41,13 +41,13 @@ import com.intellectualcrafters.plot.util.EventUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "debugclaimtest",
 | 
			
		||||
        description = "If you accidentally delete your database, this command will attempt to restore all plots based on the data from plot sighs. Execution time may vary",
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        requiredType = PS.class,
 | 
			
		||||
        requiredType = RequiredType.CONSOLE,
 | 
			
		||||
        permission = "plots.debugclaimtest"
 | 
			
		||||
)
 | 
			
		||||
public class DebugClaimTest extends SubCommand {
 | 
			
		||||
@@ -70,7 +70,7 @@ public class DebugClaimTest extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        if (args.length < 3) {
 | 
			
		||||
            return !MainUtil.sendMessage(null, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
@@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "debugclear",
 | 
			
		||||
@@ -44,46 +44,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class DebugClear extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
        if (plr == null) {
 | 
			
		||||
            // Is console
 | 
			
		||||
            if (args.length < 2) {
 | 
			
		||||
                PS.log("You need to specify two arguments: ID (0;0) & World (world)");
 | 
			
		||||
            } else {
 | 
			
		||||
                final PlotId id = PlotId.fromString(args[0]);
 | 
			
		||||
                final String world = args[1];
 | 
			
		||||
                if (id == null) {
 | 
			
		||||
                    PS.log("Invalid Plot ID: " + args[0]);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (!PS.get().isPlotWorld(world) || !(PS.get().getPlotWorld(world) instanceof SquarePlotWorld)) {
 | 
			
		||||
                        PS.log("Invalid plot world: " + world);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        final Plot plot = MainUtil.getPlot(world, id);
 | 
			
		||||
                        if (plot == null) {
 | 
			
		||||
                            PS.log("Could not find plot " + args[0] + " in world " + world);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
 | 
			
		||||
                            final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id);
 | 
			
		||||
                            if (MainUtil.runners.containsKey(plot)) {
 | 
			
		||||
                                MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
 | 
			
		||||
                                return false;
 | 
			
		||||
                            }
 | 
			
		||||
                            MainUtil.runners.put(plot, 1);
 | 
			
		||||
                            ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
 | 
			
		||||
                                @Override
 | 
			
		||||
                                public void run() {
 | 
			
		||||
                                    MainUtil.runners.remove(plot);
 | 
			
		||||
                                    PS.log("Plot " + plot.getId().toString() + " cleared.");
 | 
			
		||||
                                    PS.log("&aDone!");
 | 
			
		||||
                                }
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, String[] args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if ((plot == null) || !(PS.get().getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) {
 | 
			
		||||
@@ -109,8 +70,6 @@ public class DebugClear extends SubCommand {
 | 
			
		||||
                MainUtil.sendMessage(plr, "&aDone!");
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        // sign
 | 
			
		||||
        // wall
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,9 +30,9 @@ import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
@@ -64,17 +64,12 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
public class DebugExec extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer player = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, String[] args) {
 | 
			
		||||
        final List<String> allowed_params = Arrays.asList("calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "trim-check");
 | 
			
		||||
        if (args.length > 0) {
 | 
			
		||||
            final String arg = args[0].toLowerCase();
 | 
			
		||||
            switch (arg) {
 | 
			
		||||
                case "analyze": {
 | 
			
		||||
                    if (player == null) {
 | 
			
		||||
                        MainUtil.sendMessage(player, C.IS_CONSOLE);
 | 
			
		||||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
                    Plot plot = MainUtil.getPlot(player.getLocation());
 | 
			
		||||
                    if (plot == null) {
 | 
			
		||||
                        MainUtil.sendMessage(player, C.NOT_IN_PLOT);
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "fill",
 | 
			
		||||
@@ -39,13 +39,12 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        usage = "/plot fill",
 | 
			
		||||
        aliases = {"debugfill"},
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class DebugFill extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String ... args) {
 | 
			
		||||
        if (args.length != 1 || (!args[0].equalsIgnoreCase("outline") && !args[0].equalsIgnoreCase("all"))) {
 | 
			
		||||
            MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot fill <outline|all>");
 | 
			
		||||
            return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -35,14 +35,14 @@ import com.intellectualcrafters.plot.util.BlockManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "debugfixflags",
 | 
			
		||||
        usage = "/plot debugfixflags <world>",
 | 
			
		||||
        permission = "plots.debugfixflags",
 | 
			
		||||
        description = "Attempt to fix all flags for a world",
 | 
			
		||||
        requiredType = PS.class,
 | 
			
		||||
        requiredType = RequiredType.CONSOLE,
 | 
			
		||||
        category = CommandCategory.DEBUG
 | 
			
		||||
)
 | 
			
		||||
public class DebugFixFlags extends SubCommand {
 | 
			
		||||
@@ -54,8 +54,7 @@ public class DebugFixFlags extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer plr = null;
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        final String world = args[0];
 | 
			
		||||
        if (!BlockManager.manager.isWorld(world) || !PS.get().isPlotWorld(world)) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "debugloadtest",
 | 
			
		||||
@@ -35,12 +35,12 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        description = "This debug command will force the reload of all plots in the DB",
 | 
			
		||||
        usage = "/plot debugloadtest",
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        requiredType = PS.class
 | 
			
		||||
        requiredType = RequiredType.CONSOLE
 | 
			
		||||
)
 | 
			
		||||
public class DebugLoadTest extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        try {
 | 
			
		||||
            final Field fPlots = PS.class.getDeclaredField("plots");
 | 
			
		||||
            fPlots.setAccessible(true);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.bukkit.BukkitMain;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
@@ -26,7 +26,7 @@ import java.io.IOException;
 | 
			
		||||
public class DebugPaste extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, String[] args) {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, String[] args) {
 | 
			
		||||
        TaskManager.runTaskAsync(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
@@ -36,7 +36,7 @@ public class DebugPaste extends SubCommand {
 | 
			
		||||
                    try {
 | 
			
		||||
                        latestLOG = HastebinUtility.upload(new File(BukkitMain.THIS.getDirectory(), "../../logs/latest.log"));
 | 
			
		||||
                    } catch(final Exception e) {
 | 
			
		||||
                        caller.message("&clatest.log is too big to be pasted, will ignore");
 | 
			
		||||
                        plr.sendMessage("&clatest.log is too big to be pasted, will ignore");
 | 
			
		||||
                        latestLOG = "too big :(";
 | 
			
		||||
                    }
 | 
			
		||||
                    StringBuilder b = new StringBuilder();
 | 
			
		||||
@@ -65,7 +65,7 @@ public class DebugPaste extends SubCommand {
 | 
			
		||||
                    b.append("\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues");
 | 
			
		||||
 | 
			
		||||
                    String link = HastebinUtility.upload(b.toString());
 | 
			
		||||
                    caller.message(C.DEBUG_REPORT_CREATED.s().replace("%url%", link));
 | 
			
		||||
                    plr.sendMessage(C.DEBUG_REPORT_CREATED.s().replace("%url%", link));
 | 
			
		||||
                } catch (IOException e) {
 | 
			
		||||
                    e.printStackTrace();
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -29,12 +29,12 @@ import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "debugroadregen",
 | 
			
		||||
        usage = "/plot debugroadregen",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        description = "Regenerate all roads based on the road schematic",
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        permission = "plots.debugroadregen"
 | 
			
		||||
@@ -42,8 +42,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class DebugRoadRegen extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String ... args) {
 | 
			
		||||
        final Location loc = player.getLocation();
 | 
			
		||||
        final String world = loc.getWorld();
 | 
			
		||||
        if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -28,20 +28,20 @@ import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "debugsavetest",
 | 
			
		||||
        permission = "plots.debugsavetest",
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        requiredType = PS.class,
 | 
			
		||||
        requiredType = RequiredType.CONSOLE,
 | 
			
		||||
        usage = "/plot debugsavetest",
 | 
			
		||||
        description = "This command will force the recreation of all plots in the DB"
 | 
			
		||||
)
 | 
			
		||||
public class DebugSaveTest extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        final ArrayList<Plot> plots = new ArrayList<Plot>();
 | 
			
		||||
        plots.addAll(PS.get().getPlots());
 | 
			
		||||
        MainUtil.sendMessage(null, "&6Starting `DEBUGSAVETEST`");
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
 | 
			
		||||
@@ -57,7 +57,7 @@ import com.intellectualcrafters.plot.uuid.UUIDWrapper;
 | 
			
		||||
        permission = "plots.admin",
 | 
			
		||||
        description = "Debug UUID conversion",
 | 
			
		||||
        usage = "/plot uuidconvert <lower|offline|online>",
 | 
			
		||||
        requiredType = PS.class,
 | 
			
		||||
        requiredType = RequiredType.CONSOLE,
 | 
			
		||||
        category = CommandCategory.DEBUG
 | 
			
		||||
)
 | 
			
		||||
public class DebugUUID extends SubCommand {
 | 
			
		||||
@@ -69,7 +69,7 @@ public class DebugUUID extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        PlotPlayer player = null;
 | 
			
		||||
 | 
			
		||||
        UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper();
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "delete",
 | 
			
		||||
@@ -42,13 +42,13 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        description = "Delete a plot",
 | 
			
		||||
        usage = "/plot delete",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Delete extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
@@ -43,7 +43,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
        description = "Deny a user from a plot",
 | 
			
		||||
        usage = "/plot deny <player>",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Deny extends SubCommand {
 | 
			
		||||
 | 
			
		||||
@@ -54,8 +54,8 @@ public class Deny extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -14,21 +14,21 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SchematicHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "download",
 | 
			
		||||
        aliases = {"dl"},
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        description = "Download your plot",
 | 
			
		||||
        permission = "plots.download"
 | 
			
		||||
)
 | 
			
		||||
public class Download extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        if (!Settings.METRICS) {
 | 
			
		||||
            MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ import java.util.Arrays;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
@@ -45,14 +45,14 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
        aliases = {"f"},
 | 
			
		||||
        description = "Manage plot flags",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        permission = "plots.flag"
 | 
			
		||||
)
 | 
			
		||||
public class FlagCmd extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String ... args) {
 | 
			
		||||
        
 | 
			
		||||
        /*
 | 
			
		||||
         *  plot flag set fly true
 | 
			
		||||
         *  plot flag remove fly
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "help",
 | 
			
		||||
@@ -20,7 +20,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class Help extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "home",
 | 
			
		||||
@@ -36,7 +36,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        description = "Go to your plot",
 | 
			
		||||
        usage = "/plot home [id|alias]",
 | 
			
		||||
        category = CommandCategory.TELEPORT,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Home extends SubCommand {
 | 
			
		||||
 | 
			
		||||
@@ -50,8 +50,8 @@ public class Home extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final ArrayList<Plot> plots = PS.get().sortPlotsByWorld(PS.get().getPlots(plr));
 | 
			
		||||
        if (plots.size() == 1) {
 | 
			
		||||
            MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
@@ -43,7 +43,7 @@ import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
        usage = "/plot inbox [inbox] [delete <index>|clear|page]",
 | 
			
		||||
        permission = "plots.inbox",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Inbox extends SubCommand {
 | 
			
		||||
    
 | 
			
		||||
@@ -86,8 +86,8 @@ public class Inbox extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(player.getLocation());
 | 
			
		||||
        if (args.length == 0) {
 | 
			
		||||
 
 | 
			
		||||
@@ -25,10 +25,10 @@ import java.util.Collection;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.regex.Matcher;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.flag.Flag;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
 | 
			
		||||
@@ -88,9 +88,7 @@ public class Info extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, String[] args) {
 | 
			
		||||
        final PlotPlayer player = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, String[] args) {
 | 
			
		||||
        String arg = null;
 | 
			
		||||
        Plot plot;
 | 
			
		||||
        if (args.length > 0) arg = args[0] + "";
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "kick",
 | 
			
		||||
@@ -37,13 +37,13 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        description = "Kick a player from your plot",
 | 
			
		||||
        permission = "plots.kick",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Kick extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -17,13 +17,13 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "load",
 | 
			
		||||
        aliases = {"restore"},
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        description = "Load your plot",
 | 
			
		||||
        permission = "plots.load",
 | 
			
		||||
        usage = "/plot restore"
 | 
			
		||||
@@ -31,8 +31,8 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class Load extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        if (!Settings.METRICS) {
 | 
			
		||||
            MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -24,22 +24,23 @@ import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.ConsoleCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MathMan;
 | 
			
		||||
import com.intellectualcrafters.plot.util.StringComparison;
 | 
			
		||||
import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.Command;
 | 
			
		||||
import com.intellectualsites.commands.CommandHandlingOutput;
 | 
			
		||||
import com.intellectualsites.commands.CommandManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualsites.commands.util.StringUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * PlotSquared command class
 | 
			
		||||
@@ -92,13 +93,12 @@ public class MainCommand extends CommandManager {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static List<Command> getCommands(final CommandCategory category, final PlotPlayer player) {
 | 
			
		||||
        final List<Command> cmds = new ArrayList<>();
 | 
			
		||||
        for (final Command c : instance.commands.values()) {
 | 
			
		||||
            if (c.getRequiredType().isInstance(PlotPlayer.class)) {
 | 
			
		||||
                if ((category == null || (c.getCategory().equals(category))) && player.hasPermission(c.getPermission())) {
 | 
			
		||||
                    cmds.add(c);
 | 
			
		||||
                }
 | 
			
		||||
    public static ArrayList<Command> getCommands(final CommandCategory category, final PlotPlayer player) {
 | 
			
		||||
        ArrayList<Command> cmds = instance.getCommands();
 | 
			
		||||
        for (Iterator<Command> iter = cmds.iterator(); iter.hasNext();){
 | 
			
		||||
            Command cmd = iter.next();
 | 
			
		||||
            if ((category != null && (cmd.getCategory().equals(category))) || !player.hasPermission(cmd.getPermission())) {
 | 
			
		||||
                iter.remove();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return cmds;
 | 
			
		||||
@@ -142,106 +142,134 @@ public class MainCommand extends CommandManager {
 | 
			
		||||
        return help;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean onCommand(final PlotPlayer player, final String cmd, final String... args) {
 | 
			
		||||
        if ((args.length < 1) || ((args.length >= 1) && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("he")))) {
 | 
			
		||||
            if (args.length < 2) {
 | 
			
		||||
                final StringBuilder builder = new StringBuilder();
 | 
			
		||||
                builder.append(C.HELP_INFO.s());
 | 
			
		||||
                for (final CommandCategory category : CommandCategory.values()) {
 | 
			
		||||
                    builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
 | 
			
		||||
                }
 | 
			
		||||
                builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all").replaceAll("%category_desc%", "Display all commands"));
 | 
			
		||||
                return MainUtil.sendMessage(player, builder.toString());
 | 
			
		||||
            }
 | 
			
		||||
            final String cat = args[1];
 | 
			
		||||
            CommandCategory cato = null;
 | 
			
		||||
            for (final CommandCategory category : CommandCategory.values()) {
 | 
			
		||||
                if (cat.equalsIgnoreCase(category.toString())) {
 | 
			
		||||
                    cato = category;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if ((cato == null) && !cat.equalsIgnoreCase("all")) {
 | 
			
		||||
                final StringBuilder builder = new StringBuilder();
 | 
			
		||||
                builder.append(C.HELP_INFO.s());
 | 
			
		||||
                for (final CommandCategory category : CommandCategory.values()) {
 | 
			
		||||
                    builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
 | 
			
		||||
                }
 | 
			
		||||
                return MainUtil.sendMessage(player, builder.toString(), false);
 | 
			
		||||
            }
 | 
			
		||||
            final StringBuilder help = new StringBuilder();
 | 
			
		||||
            int page = 0;
 | 
			
		||||
            boolean digit = true;
 | 
			
		||||
            String arg2;
 | 
			
		||||
            if (args.length > 2) {
 | 
			
		||||
                arg2 = args[2];
 | 
			
		||||
            } else {
 | 
			
		||||
                arg2 = "1";
 | 
			
		||||
            }
 | 
			
		||||
            for (final char c : arg2.toCharArray()) {
 | 
			
		||||
                if (!Character.isDigit(c)) {
 | 
			
		||||
                    digit = false;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (digit) {
 | 
			
		||||
                page = Integer.parseInt(arg2);
 | 
			
		||||
                if (--page < 0) {
 | 
			
		||||
                    page = 0;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            for (final String string : helpMenu(player, cato, page)) {
 | 
			
		||||
                help.append(string).append("\n");
 | 
			
		||||
            }
 | 
			
		||||
            MainUtil.sendMessage(player, help.toString());
 | 
			
		||||
            // return PlayerFunctions.sendMessage(player, help.toString());
 | 
			
		||||
        } else {
 | 
			
		||||
            CommandCaller caller;
 | 
			
		||||
            if (player != null) {
 | 
			
		||||
                caller = new PlotPlayerCaller(player);
 | 
			
		||||
            } else {
 | 
			
		||||
                caller = new ConsoleCaller();
 | 
			
		||||
            }
 | 
			
		||||
            StringBuilder builder = new StringBuilder(cmd).append(" ");
 | 
			
		||||
            Iterator<String> iterator = Arrays.asList(args).iterator();
 | 
			
		||||
            while (iterator.hasNext()) {
 | 
			
		||||
                builder.append(iterator.next());
 | 
			
		||||
                if (iterator.hasNext()) {
 | 
			
		||||
                    builder.append(" ");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            instance.handle(caller, builder.toString());
 | 
			
		||||
            // for (final SubCommand command : subCommands) {
 | 
			
		||||
            //    if (command.cmd.equalsIgnoreCase(args[0]) || command.alias.contains(args[0].toLowerCase())) {
 | 
			
		||||
            //        final String[] arguments = new String[args.length - 1];
 | 
			
		||||
            //        System.arraycopy(args, 1, arguments, 0, args.length - 1);
 | 
			
		||||
            //        if (command.permission.hasPermissipon(player)) {
 | 
			
		||||
            //            if ((player != null) || !command.isPlayer) {
 | 
			
		||||
            //                return command.execute(player, arguments);
 | 
			
		||||
            //            } else {
 | 
			
		||||
            //                return !MainUtil.sendMessage(null, C.IS_CONSOLE);
 | 
			
		||||
            //            }
 | 
			
		||||
            //        } else {
 | 
			
		||||
            //            return no_permission(player, command.permission.permission.toLowerCase());
 | 
			
		||||
            //        }
 | 
			
		||||
            //    }
 | 
			
		||||
            // }
 | 
			
		||||
            // MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
 | 
			
		||||
            // final String[] commands = new String[subCommands.size()];
 | 
			
		||||
            // for (int x = 0; x < subCommands.size(); x++) {
 | 
			
		||||
            //    commands[x] = subCommands.get(x).cmd;
 | 
			
		||||
            // }
 | 
			
		||||
            // /* Let's try to get a proper usage string */
 | 
			
		||||
            // final String command = new StringComparison(args[0], commands).getBestMatch();
 | 
			
		||||
            // return MainUtil.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
 | 
			
		||||
            // PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new
 | 
			
		||||
            // StringComparsion(args[0], commands).getBestMatch());
 | 
			
		||||
    public static void displayHelp(PlotPlayer player, String cat, int page) {
 | 
			
		||||
        if (cat != null && StringMan.isEqualIgnoreCase(cat, "all")) {
 | 
			
		||||
            cat = null;
 | 
			
		||||
        }
 | 
			
		||||
        if (cat == null && page == 0) {
 | 
			
		||||
            final StringBuilder builder = new StringBuilder();
 | 
			
		||||
            builder.append(C.HELP_INFO.s());
 | 
			
		||||
            for (final CommandCategory category : CommandCategory.values()) {
 | 
			
		||||
                builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
 | 
			
		||||
            }
 | 
			
		||||
            builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all").replaceAll("%category_desc%", "Display all commands"));
 | 
			
		||||
            MainUtil.sendMessage(player, builder.toString());
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        CommandCategory cato = null;
 | 
			
		||||
        for (final CommandCategory category : CommandCategory.values()) {
 | 
			
		||||
            if (cat.equalsIgnoreCase(category.toString())) {
 | 
			
		||||
                cato = category;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if ((cato == null) && !cat.equalsIgnoreCase("all")) {
 | 
			
		||||
            final StringBuilder builder = new StringBuilder();
 | 
			
		||||
            builder.append(C.HELP_INFO.s());
 | 
			
		||||
            for (final CommandCategory category : CommandCategory.values()) {
 | 
			
		||||
                builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString()));
 | 
			
		||||
            }
 | 
			
		||||
            MainUtil.sendMessage(player, builder.toString(), false);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        final StringBuilder help = new StringBuilder();
 | 
			
		||||
        for (final String string : helpMenu(player, cato, page)) {
 | 
			
		||||
            help.append(string).append("\n");
 | 
			
		||||
        }
 | 
			
		||||
        MainUtil.sendMessage(player, help.toString());
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean onCommand(final PlotPlayer player, final String cmd, final String... args) {
 | 
			
		||||
        int help_index = -1;
 | 
			
		||||
        String category = null;
 | 
			
		||||
        if (args.length == 0) {
 | 
			
		||||
            help_index = 0;
 | 
			
		||||
        }
 | 
			
		||||
        else if (StringMan.isEqualIgnoreCaseToAny(args[0], "he", "help", "?")) {
 | 
			
		||||
            help_index = 0;
 | 
			
		||||
            switch (args.length) {
 | 
			
		||||
                case 3: {
 | 
			
		||||
                    category = args[1];
 | 
			
		||||
                }
 | 
			
		||||
                case 2: {
 | 
			
		||||
                    if (MathMan.isInteger(args[args.length - 1])) {
 | 
			
		||||
                        category = null;
 | 
			
		||||
                        try {
 | 
			
		||||
                            help_index = Integer.parseInt(args[1]) - 1;
 | 
			
		||||
                        }
 | 
			
		||||
                        catch (NumberFormatException e) {}
 | 
			
		||||
                    }
 | 
			
		||||
                    if (category == null) {
 | 
			
		||||
                        category = args[1];
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                case 1: {
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (args.length == 3) {
 | 
			
		||||
                if (MathMan.isInteger(args[args.length - 1])) {
 | 
			
		||||
                    category = null;
 | 
			
		||||
                    try {
 | 
			
		||||
                        help_index = Integer.parseInt(args[1]) - 1;
 | 
			
		||||
                    }
 | 
			
		||||
                    catch (NumberFormatException e) {}
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    category = args[1];
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else if (MathMan.isInteger(args[args.length - 1])) {
 | 
			
		||||
            try {
 | 
			
		||||
                help_index = Integer.parseInt(args[args.length - 1]) - 1;
 | 
			
		||||
            }
 | 
			
		||||
            catch (NumberFormatException e) {}
 | 
			
		||||
        }
 | 
			
		||||
        if (help_index != -1) {
 | 
			
		||||
            displayHelp(player, category, help_index);
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        PlotPlayer caller;
 | 
			
		||||
        StringBuilder builder = new StringBuilder(cmd).append(" ");
 | 
			
		||||
        Iterator<String> iterator = Arrays.asList(args).iterator();
 | 
			
		||||
        while (iterator.hasNext()) {
 | 
			
		||||
            builder.append(iterator.next());
 | 
			
		||||
            if (iterator.hasNext()) {
 | 
			
		||||
                builder.append(" ");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        instance.handle(player, builder.toString());
 | 
			
		||||
        // for (final SubCommand command : subCommands) {
 | 
			
		||||
        //    if (command.cmd.equalsIgnoreCase(args[0]) || command.alias.contains(args[0].toLowerCase())) {
 | 
			
		||||
        //        final String[] arguments = new String[args.length - 1];
 | 
			
		||||
        //        System.arraycopy(args, 1, arguments, 0, args.length - 1);
 | 
			
		||||
        //        if (command.permission.hasPermissipon(player)) {
 | 
			
		||||
        //            if ((player != null) || !command.isPlayer) {
 | 
			
		||||
        //                return command.execute(player, arguments);
 | 
			
		||||
        //            } else {
 | 
			
		||||
        //                return !MainUtil.sendMessage(null, C.IS_CONSOLE);
 | 
			
		||||
        //            }
 | 
			
		||||
        //        } else {
 | 
			
		||||
        //            return no_permission(player, command.permission.permission.toLowerCase());
 | 
			
		||||
        //        }
 | 
			
		||||
        //    }
 | 
			
		||||
        // }
 | 
			
		||||
        // MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
 | 
			
		||||
        // final String[] commands = new String[subCommands.size()];
 | 
			
		||||
        // for (int x = 0; x < subCommands.size(); x++) {
 | 
			
		||||
        //    commands[x] = subCommands.get(x).cmd;
 | 
			
		||||
        // }
 | 
			
		||||
        // /* Let's try to get a proper usage string */
 | 
			
		||||
        // final String command = new StringComparison(args[0], commands).getBestMatch();
 | 
			
		||||
        // return MainUtil.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
 | 
			
		||||
        // PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new
 | 
			
		||||
        // StringComparsion(args[0], commands).getBestMatch());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int handle(CommandCaller caller, String input) {
 | 
			
		||||
    public int handle(PlotPlayer plr, String input) {
 | 
			
		||||
        String[] parts = input.split(" ");
 | 
			
		||||
        String[] args;
 | 
			
		||||
        String command = parts[0].toLowerCase();
 | 
			
		||||
@@ -252,29 +280,31 @@ public class MainCommand extends CommandManager {
 | 
			
		||||
            System.arraycopy(parts, 1, args, 0, args.length);
 | 
			
		||||
        }
 | 
			
		||||
        Command cmd = null;
 | 
			
		||||
        System.out.print(command);
 | 
			
		||||
        System.out.print(StringMan.join(commands.entrySet(), ", "));
 | 
			
		||||
        cmd = this.commands.get(command);
 | 
			
		||||
        if (cmd == null) {
 | 
			
		||||
            caller.message(C.NOT_VALID_SUBCOMMAND);
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NOT_VALID_SUBCOMMAND);
 | 
			
		||||
            {
 | 
			
		||||
                final String[] commands = new String[this.commands.size()];
 | 
			
		||||
                for (int i = 0; i < commands.length; i++) {
 | 
			
		||||
                    commands[i] = this.commands.get(i).getCommand();
 | 
			
		||||
                }
 | 
			
		||||
                final String bestMatch = new StringComparison<String>(args[0], commands).getBestMatch();
 | 
			
		||||
                caller.message(C.DID_YOU_MEAN, "/plot " + bestMatch);
 | 
			
		||||
                MainUtil.sendMessage(plr, C.DID_YOU_MEAN, "/plot " + bestMatch);
 | 
			
		||||
            }
 | 
			
		||||
            return CommandHandlingOutput.NOT_FOUND;
 | 
			
		||||
        }
 | 
			
		||||
        if (!cmd.getRequiredType().isInstance(caller.getSuperCaller())) {
 | 
			
		||||
            if (caller instanceof PlotPlayerCaller) {
 | 
			
		||||
                caller.message(C.NOT_CONSOLE);
 | 
			
		||||
        if (cmd.getRequiredType().allows(plr)) {
 | 
			
		||||
            if (ConsolePlayer.isConsole(plr)) {
 | 
			
		||||
                MainUtil.sendMessage(plr, C.IS_CONSOLE);
 | 
			
		||||
            } else {
 | 
			
		||||
                caller.message(C.IS_CONSOLE);
 | 
			
		||||
                return CommandHandlingOutput.CALLER_OF_WRONG_TYPE;
 | 
			
		||||
                MainUtil.sendMessage(plr, C.NOT_CONSOLE);
 | 
			
		||||
            }
 | 
			
		||||
            return CommandHandlingOutput.CALLER_OF_WRONG_TYPE;
 | 
			
		||||
        }
 | 
			
		||||
        if (!caller.hasPermission(cmd.getPermission())) {
 | 
			
		||||
            caller.message(C.NO_PERMISSION, cmd.getPermission());
 | 
			
		||||
        if (!plr.hasPermission(cmd.getPermission())) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NO_PERMISSION, cmd.getPermission());
 | 
			
		||||
            return CommandHandlingOutput.NOT_PERMITTED;
 | 
			
		||||
        }
 | 
			
		||||
        Argument[] requiredArguments = cmd.getRequiredArguments();
 | 
			
		||||
@@ -291,16 +321,16 @@ public class MainCommand extends CommandManager {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (!success) {
 | 
			
		||||
                caller.sendRequiredArgumentsList(this, cmd, requiredArguments);
 | 
			
		||||
                C.COMMAND_SYNTAX.send(plr, cmd.getUsage());
 | 
			
		||||
                return CommandHandlingOutput.WRONG_USAGE;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        try {
 | 
			
		||||
            boolean a = cmd.onCommand(caller, args);
 | 
			
		||||
            if (!a) {
 | 
			
		||||
            boolean result = cmd.onCommand(plr, args);
 | 
			
		||||
            if (!result) {
 | 
			
		||||
                String usage = cmd.getUsage();
 | 
			
		||||
                if (usage != null && !usage.isEmpty()) {
 | 
			
		||||
                    caller.message(usage);
 | 
			
		||||
                    MainUtil.sendMessage(plr, usage);
 | 
			
		||||
                }
 | 
			
		||||
                return CommandHandlingOutput.WRONG_USAGE;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
 | 
			
		||||
@@ -51,7 +51,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
        permission = "plots.merge",
 | 
			
		||||
        usage = "/plot merge [direction]",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Merge extends SubCommand {
 | 
			
		||||
    public final static String[] values = new String[] { "north", "east", "south", "west" };
 | 
			
		||||
@@ -86,8 +86,8 @@ public class Merge extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocationFull();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "move",
 | 
			
		||||
@@ -39,7 +39,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        aliases = {"debugmove"},
 | 
			
		||||
        permission = "plots.move",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Move extends SubCommand {
 | 
			
		||||
 | 
			
		||||
@@ -50,8 +50,8 @@ public class Move extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot1 = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot1 == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.BlockManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "music",
 | 
			
		||||
@@ -40,13 +40,13 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        description = "Player music in a plot",
 | 
			
		||||
        usage = "/plot music",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class MusicSubcommand extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = player.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.object.PlotId;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
@@ -41,7 +41,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        permission = "plots.admin",
 | 
			
		||||
        description = "Purge all plots for a world",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PS.class
 | 
			
		||||
        requiredType = RequiredType.CONSOLE
 | 
			
		||||
)
 | 
			
		||||
public class Purge extends SubCommand {
 | 
			
		||||
    
 | 
			
		||||
@@ -55,45 +55,45 @@ public class Purge extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        if (args.length == 1) {
 | 
			
		||||
            final String arg = args[0].toLowerCase();
 | 
			
		||||
            final PlotId id = getId(arg);
 | 
			
		||||
            if (id != null) {
 | 
			
		||||
                caller.message("/plot purxe x;z &l<world>");
 | 
			
		||||
                MainUtil.sendMessage(plr, "/plot purxe x;z &l<world>");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            final UUID uuid = UUIDHandler.getUUID(args[0], null);
 | 
			
		||||
            if (uuid != null) {
 | 
			
		||||
                caller.message("/plot purge " + args[0] + " &l<world>");
 | 
			
		||||
                MainUtil.sendMessage(plr, "/plot purge " + args[0] + " &l<world>");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            if (arg.equals("player")) {
 | 
			
		||||
                caller.message("/plot purge &l<player> <world>");
 | 
			
		||||
                MainUtil.sendMessage(plr, "/plot purge &l<player> <world>");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            if (arg.equals("unowned")) {
 | 
			
		||||
                caller.message("/plot purge unowned &l<world>");
 | 
			
		||||
                MainUtil.sendMessage(plr, "/plot purge unowned &l<world>");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            if (arg.equals("unknown")) {
 | 
			
		||||
                caller.message("/plot purge unknown &l<world>");
 | 
			
		||||
                MainUtil.sendMessage(plr, "/plot purge unknown &l<world>");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            if (arg.equals("all")) {
 | 
			
		||||
                caller.message("/plot purge all &l<world>");
 | 
			
		||||
                MainUtil.sendMessage(plr, "/plot purge all &l<world>");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            caller.message(C.PURGE_SYNTAX);
 | 
			
		||||
            MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (args.length != 2) {
 | 
			
		||||
            caller.message(C.PURGE_SYNTAX);
 | 
			
		||||
            MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        final String worldname = args[1];
 | 
			
		||||
        if (!PS.get().getAllPlotsRaw().containsKey(worldname)) {
 | 
			
		||||
            caller.message("INVALID WORLD");
 | 
			
		||||
            MainUtil.sendMessage(plr, "INVALID WORLD");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        final String arg = args[0].toLowerCase();
 | 
			
		||||
@@ -160,7 +160,7 @@ public class Purge extends SubCommand {
 | 
			
		||||
            DBFunc.purge(worldname, ids);
 | 
			
		||||
            return finishPurge(length);
 | 
			
		||||
        }
 | 
			
		||||
        caller.message(C.PURGE_SYNTAX);
 | 
			
		||||
        MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ import java.util.Map.Entry;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
import org.apache.commons.lang.mutable.MutableInt;
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
@@ -53,14 +53,12 @@ import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
        usage = "/plot rate [#|next]",
 | 
			
		||||
        aliases = {"rt"},
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Rate extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String[] args) {
 | 
			
		||||
        if (args.length == 1) {
 | 
			
		||||
            if (args[0].equalsIgnoreCase("next")) {
 | 
			
		||||
                ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
 | 
			
		||||
 
 | 
			
		||||
@@ -30,16 +30,17 @@ import com.intellectualcrafters.plot.object.ChunkLoc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotManager;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.ChunkManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "regenallroads",
 | 
			
		||||
        description = "Regenerate all roads in the map using the set road schematic",
 | 
			
		||||
        aliases = {"rgar"},
 | 
			
		||||
        category = CommandCategory.DEBUG,
 | 
			
		||||
        requiredType = PS.class,
 | 
			
		||||
        requiredType = RequiredType.CONSOLE,
 | 
			
		||||
        permission = "plots.regenallroads"
 | 
			
		||||
)
 | 
			
		||||
public class RegenAllRoads extends SubCommand {
 | 
			
		||||
@@ -51,22 +52,22 @@ public class RegenAllRoads extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        int height = 0;
 | 
			
		||||
        if (args.length == 2) {
 | 
			
		||||
            try {
 | 
			
		||||
                height = Integer.parseInt(args[1]);
 | 
			
		||||
            }
 | 
			
		||||
            catch (NumberFormatException e) {
 | 
			
		||||
                caller.message(C.NOT_VALID_NUMBER, "(0, 256)");
 | 
			
		||||
                caller.message(C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
 | 
			
		||||
                MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(0, 256)");
 | 
			
		||||
                MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        final String name = args[0];
 | 
			
		||||
        final PlotManager manager = PS.get().getPlotManager(name);
 | 
			
		||||
        if ((manager == null) || !(manager instanceof HybridPlotManager)) {
 | 
			
		||||
            caller.message(C.NOT_VALID_PLOT_WORLD);
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        final List<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
 | 
			
		||||
 
 | 
			
		||||
@@ -23,9 +23,9 @@ package com.intellectualcrafters.plot.commands;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotWorld;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "reload",
 | 
			
		||||
@@ -37,7 +37,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
public class Reload extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        try {
 | 
			
		||||
            // The following won't affect world generation, as that has to be
 | 
			
		||||
            // loaded during startup unfortunately.
 | 
			
		||||
@@ -48,9 +48,9 @@ public class Reload extends SubCommand {
 | 
			
		||||
                final PlotWorld plotworld = PS.get().getPlotWorld(pw);
 | 
			
		||||
                plotworld.loadDefaultConfiguration(PS.get().config.getConfigurationSection("worlds." + pw));
 | 
			
		||||
            }
 | 
			
		||||
            caller.message(C.RELOADED_CONFIGS);
 | 
			
		||||
            MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);
 | 
			
		||||
        } catch (final Exception e) {
 | 
			
		||||
            caller.message(C.RELOAD_FAILED);
 | 
			
		||||
            MainUtil.sendMessage(plr, C.RELOAD_FAILED);
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,6 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
@@ -42,7 +41,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
        description = "Remove a player from a plot",
 | 
			
		||||
        usage = "/plot remove <player>",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        permission = "plots.remove"
 | 
			
		||||
)
 | 
			
		||||
public class Remove extends SubCommand {
 | 
			
		||||
@@ -54,8 +53,7 @@ public class Remove extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        if (args.length != 1) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot remove <player>");
 | 
			
		||||
            return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
public enum RequiredType {
 | 
			
		||||
    CONSOLE,
 | 
			
		||||
    PLAYER,
 | 
			
		||||
    NONE;
 | 
			
		||||
    
 | 
			
		||||
    public boolean allows(PlotPlayer player) {
 | 
			
		||||
        switch (this) {
 | 
			
		||||
            case NONE:
 | 
			
		||||
                return true;
 | 
			
		||||
            case PLAYER:
 | 
			
		||||
                return !ConsolePlayer.isConsole(player);
 | 
			
		||||
            case CONSOLE:
 | 
			
		||||
                return ConsolePlayer.isConsole(player);
 | 
			
		||||
            default:
 | 
			
		||||
                return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -17,21 +17,21 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SchematicHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "save",
 | 
			
		||||
        aliases = {"backup"},
 | 
			
		||||
        description = "Save your plot",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        permission = "plots.save"
 | 
			
		||||
)
 | 
			
		||||
public class Save extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        if (!Settings.METRICS) {
 | 
			
		||||
            MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ import java.util.HashMap;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
@@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
// TODO Add sub-subcommands
 | 
			
		||||
 | 
			
		||||
@@ -61,8 +61,7 @@ public class SchematicCmd extends SubCommand {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        if (args.length < 1) {
 | 
			
		||||
            sendMessage(plr, C.SCHEMATIC_MISSING_ARG);
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -72,10 +71,6 @@ public class SchematicCmd extends SubCommand {
 | 
			
		||||
        final Schematic schematic;
 | 
			
		||||
        switch (arg) {
 | 
			
		||||
            case "paste": {
 | 
			
		||||
                if (plr == null) {
 | 
			
		||||
                    PS.log(C.IS_CONSOLE.s());
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
                if (!Permissions.hasPermission(plr, "plots.schematic.paste")) {
 | 
			
		||||
                    MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.paste");
 | 
			
		||||
                    return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
 | 
			
		||||
@@ -61,15 +61,15 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
        usage = "/plot set <arg> <value(s)...>",
 | 
			
		||||
        permission = "plots.set",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Set extends SubCommand {
 | 
			
		||||
    public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
 | 
			
		||||
    public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "setowner",
 | 
			
		||||
@@ -45,7 +45,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        usage = "/plot setowner <player>",
 | 
			
		||||
        aliases = {"so"},
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class SetOwner extends SubCommand {
 | 
			
		||||
 | 
			
		||||
@@ -60,8 +60,7 @@ public class SetOwner extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller;
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if ((plot == null) || (plot.owner == null)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -25,9 +25,9 @@ import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
import org.bukkit.generator.ChunkGenerator;
 | 
			
		||||
@@ -74,9 +74,7 @@ public class Setup extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        PlotPlayer plr = (caller instanceof PlotPlayerCaller) ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        // going through setup
 | 
			
		||||
        String name;
 | 
			
		||||
        if (plr == null) {
 | 
			
		||||
@@ -219,7 +217,7 @@ public class Setup extends SubCommand {
 | 
			
		||||
                    step.setValue(args[0]);
 | 
			
		||||
                    object.setup_index++;
 | 
			
		||||
                    if (object.setup_index == object.step.length) {
 | 
			
		||||
                        onCommand(caller, args);
 | 
			
		||||
                        onCommand(plr, args);
 | 
			
		||||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
                    step = object.step[object.setup_index];
 | 
			
		||||
 
 | 
			
		||||
@@ -34,20 +34,20 @@ import com.intellectualcrafters.plot.util.ClusterManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "swap",
 | 
			
		||||
        description = "Swap two plots",
 | 
			
		||||
        aliases = {"switch"},
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = PlotPlayer.class
 | 
			
		||||
        requiredType = RequiredType.PLAYER
 | 
			
		||||
)
 | 
			
		||||
public class Swap extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        MainUtil.sendMessage(plr, "&cThis command has not been optimized for large selections yet. Please bug me if this becomes an issue.");
 | 
			
		||||
        if (args.length < 1) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NEED_PLOT_ID);
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
 | 
			
		||||
@@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
        description = "Teleport to a plot",
 | 
			
		||||
        permission = "plots.tp",
 | 
			
		||||
        usage = "/plot tp <alias|id>",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        category = CommandCategory.TELEPORT
 | 
			
		||||
)
 | 
			
		||||
public class TP extends SubCommand {
 | 
			
		||||
@@ -53,8 +53,7 @@ public class TP extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        final String id = args[0];
 | 
			
		||||
        PlotId plotid;
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
 
 | 
			
		||||
@@ -28,14 +28,14 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "target",
 | 
			
		||||
        usage = "/plot target <X;Z>",
 | 
			
		||||
        description = "Target a plot with your compass",
 | 
			
		||||
        permission = "plots.target",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        category = CommandCategory.ACTIONS
 | 
			
		||||
)
 | 
			
		||||
public class Target extends SubCommand {
 | 
			
		||||
@@ -47,8 +47,7 @@ public class Target extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        final Location ploc = plr.getLocation();
 | 
			
		||||
        if (!PS.get().isPlotWorld(ploc.getWorld())) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ import com.intellectualcrafters.plot.object.SetupObject;
 | 
			
		||||
import com.intellectualcrafters.plot.util.BlockManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.bukkit.util.SetupUtils;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
 | 
			
		||||
@@ -119,25 +119,21 @@ public class Template extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        if (args.length != 2 && args.length != 3) {
 | 
			
		||||
            if (args.length == 1) {
 | 
			
		||||
                if (args[0].equalsIgnoreCase("export")) {
 | 
			
		||||
                    caller.message(C.COMMAND_SYNTAX, "/plot template export <world>");
 | 
			
		||||
                    MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template export <world>");
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
                else if (args[0].equalsIgnoreCase("import")) {
 | 
			
		||||
                    caller.message(C.COMMAND_SYNTAX, "/plot template import <world> <template>");
 | 
			
		||||
                    MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template import <world> <template>");
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            caller.message(C.COMMAND_SYNTAX, "/plot template <import|explort> <world> [template]");
 | 
			
		||||
            MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|explort> <world> [template]");
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        PlotPlayer plr = null;
 | 
			
		||||
        if (caller.getSuperCaller() instanceof PlotPlayer) {
 | 
			
		||||
            plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
        }
 | 
			
		||||
        final String world = args[1];
 | 
			
		||||
        switch (args[0].toLowerCase()) {
 | 
			
		||||
            case "import": {
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
//     TOGGLE("toggle", "attribute"),
 | 
			
		||||
 | 
			
		||||
@@ -34,21 +34,20 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        permission = "plots.toggle",
 | 
			
		||||
        description = "Toggle per user settings",
 | 
			
		||||
        usage = "/plot toggle <setting>",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        category = CommandCategory.ACTIONS
 | 
			
		||||
)
 | 
			
		||||
public class Toggle extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    public void noArgs(CommandCaller caller) {
 | 
			
		||||
        caller.message(C.COMMAND_SYNTAX, "/plot toggle <setting>");
 | 
			
		||||
        caller.message(C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + "titles");
 | 
			
		||||
    public void noArgs(PlotPlayer plr) {
 | 
			
		||||
        MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot toggle <setting>");
 | 
			
		||||
        MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + "titles");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer player, final String[] args) {
 | 
			
		||||
        if (args.length == 0) {
 | 
			
		||||
            noArgs(caller);
 | 
			
		||||
            noArgs(player);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        switch (args[0].toLowerCase()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -40,14 +40,14 @@ import com.intellectualcrafters.plot.util.ChunkManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "trim",
 | 
			
		||||
        permission = "plots.admin",
 | 
			
		||||
        description = "Delete unmodified portions of your plotworld",
 | 
			
		||||
        usage = "/plot trim",
 | 
			
		||||
        requiredType = PS.class,
 | 
			
		||||
        requiredType = RequiredType.CONSOLE,
 | 
			
		||||
        category = CommandCategory.DEBUG
 | 
			
		||||
)
 | 
			
		||||
public class Trim extends SubCommand {
 | 
			
		||||
@@ -174,8 +174,7 @@ public class Trim extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        PlotPlayer plr = null;
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        if (args.length == 1) {
 | 
			
		||||
            final String arg = args[0].toLowerCase();
 | 
			
		||||
            final PlotId id = getId(arg);
 | 
			
		||||
 
 | 
			
		||||
@@ -34,13 +34,13 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "trust",
 | 
			
		||||
        aliases = {"t"},
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        usage = "/plot trust <player>",
 | 
			
		||||
        description = "Allow a player to build in a plot",
 | 
			
		||||
        category = CommandCategory.ACTIONS
 | 
			
		||||
@@ -54,8 +54,8 @@ public class Trust extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -30,20 +30,20 @@ import com.intellectualcrafters.plot.util.EconHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "unclaim",
 | 
			
		||||
        usage = "/plot unclaim",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        description = "Unclaim a plot",
 | 
			
		||||
        category = CommandCategory.ACTIONS
 | 
			
		||||
)
 | 
			
		||||
public class Unclaim extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
@@ -40,7 +40,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
 | 
			
		||||
        aliases = {"ud"},
 | 
			
		||||
        description = "Remove a denied user from a plot",
 | 
			
		||||
        usage = "/plot undeny <player>",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        category = CommandCategory.ACTIONS
 | 
			
		||||
)
 | 
			
		||||
public class Undeny extends SubCommand {
 | 
			
		||||
@@ -52,8 +52,8 @@ public class Undeny extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String ... args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String ... args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -30,21 +30,21 @@ import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "unlink",
 | 
			
		||||
        aliases = {"u"},
 | 
			
		||||
        description = "Unlink a mega-plot",
 | 
			
		||||
        usage = "/plot unlink",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        category = CommandCategory.ACTIONS
 | 
			
		||||
)
 | 
			
		||||
public class Unlink extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
//     UNTRUST("untrust", "ut"),
 | 
			
		||||
 | 
			
		||||
@@ -42,7 +42,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        permission = "plot.untrust",
 | 
			
		||||
        description = "Remove a trusted user from a plot",
 | 
			
		||||
        usage = "/plot untrust <player>",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        category = CommandCategory.ACTIONS
 | 
			
		||||
)
 | 
			
		||||
public class Untrust extends SubCommand {
 | 
			
		||||
@@ -54,8 +54,7 @@ public class Untrust extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlot(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -28,14 +28,14 @@ import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "update",
 | 
			
		||||
        permission = "plots.admin",
 | 
			
		||||
        description = "Update PlotSquared",
 | 
			
		||||
        usage = "/plot update",
 | 
			
		||||
        requiredType = PS.class,
 | 
			
		||||
        requiredType = RequiredType.CONSOLE,
 | 
			
		||||
        aliases = {"updateplugin"},
 | 
			
		||||
        category = CommandCategory.DEBUG
 | 
			
		||||
)
 | 
			
		||||
@@ -44,7 +44,7 @@ public class Update extends SubCommand {
 | 
			
		||||
    public static String version;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        URL url;
 | 
			
		||||
        if (args.length == 0) {
 | 
			
		||||
            url = PS.get().update;
 | 
			
		||||
@@ -59,12 +59,12 @@ public class Update extends SubCommand {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            caller.message(C.COMMAND_SYNTAX, getUsage());
 | 
			
		||||
            MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, getUsage());
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (url == null) {
 | 
			
		||||
            caller.message("&cNo update found!");
 | 
			
		||||
            caller.message("&cTo manually specify an update URL: /plot update <url>");
 | 
			
		||||
            MainUtil.sendMessage(plr, "&cNo update found!");
 | 
			
		||||
            MainUtil.sendMessage(plr, "&cTo manually specify an update URL: /plot update <url>");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (PS.get().update(null, url) && url == PS.get().update) {
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "visit",
 | 
			
		||||
@@ -41,7 +41,7 @@ import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
        description = "Visit someones plot",
 | 
			
		||||
        usage = "/plot visit <player|aliases|world|id> [#]",
 | 
			
		||||
        aliases = {"v}"},
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        category = CommandCategory.TELEPORT
 | 
			
		||||
)
 | 
			
		||||
public class Visit extends SubCommand {
 | 
			
		||||
@@ -63,8 +63,7 @@ public class Visit extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] args) {
 | 
			
		||||
        PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
    public boolean onCommand(PlotPlayer plr, String[] args) {
 | 
			
		||||
        ArrayList<Plot> plots = new ArrayList<>();
 | 
			
		||||
        UUID user = UUIDHandler.getUUID(args[0], null);
 | 
			
		||||
        if (user != null ) {
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.bukkit.listeners.worldedit.WEManager;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
@@ -35,18 +35,17 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
        description = "Force bypass of WorldEdit",
 | 
			
		||||
        aliases = {"wea"},
 | 
			
		||||
        usage = "/plot weanywhere",
 | 
			
		||||
        requiredType = PlotPlayer.class,
 | 
			
		||||
        requiredType = RequiredType.PLAYER,
 | 
			
		||||
        category = CommandCategory.DEBUG
 | 
			
		||||
)
 | 
			
		||||
public class WE_Anywhere extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(CommandCaller caller, String[] arguments) {
 | 
			
		||||
    public boolean onCommand(PlotPlayer player, String[] arguments) {
 | 
			
		||||
        if (PS.get().worldEdit == null) {
 | 
			
		||||
            caller.message("&cWorldEdit is not enabled on this server");
 | 
			
		||||
            MainUtil.sendMessage(player, "&cWorldEdit is not enabled on this server");
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        PlotPlayer player = (PlotPlayer) caller.getSuperCaller();
 | 
			
		||||
        if (Permissions.hasPermission(player, "plots.worldedit.bypass")) {
 | 
			
		||||
            if (WEManager.bypass.contains(player.getName())) {
 | 
			
		||||
                WEManager.bypass.remove(player.getName());
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands.callers;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.Command;
 | 
			
		||||
import com.intellectualsites.commands.CommandManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
 | 
			
		||||
public class ConsoleCaller implements CommandCaller<PS> {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasPermission(String permission) {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void message(String message) {
 | 
			
		||||
        MainUtil.sendConsoleMessage(message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public PS getSuperCaller() {
 | 
			
		||||
        return PS.get();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void message(C c, String... args) {
 | 
			
		||||
        MainUtil.sendConsoleMessage(c, args);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void sendRequiredArgumentsList(CommandManager manager, Command cmd, Argument[] required) {
 | 
			
		||||
        message(C.COMMAND_SYNTAX, cmd.getUsage());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,44 +0,0 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands.callers;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualsites.commands.Argument;
 | 
			
		||||
import com.intellectualsites.commands.Command;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualsites.commands.CommandManager;
 | 
			
		||||
 | 
			
		||||
public class PlotPlayerCaller implements CommandCaller<PlotPlayer> {
 | 
			
		||||
 | 
			
		||||
    private final PlotPlayer player;
 | 
			
		||||
 | 
			
		||||
    public PlotPlayerCaller(final PlotPlayer player) {
 | 
			
		||||
        this.player = player;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasPermission(String permission) {
 | 
			
		||||
        return player.hasPermission(permission);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void message(String message) {
 | 
			
		||||
        player.sendMessage(message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public PlotPlayer getSuperCaller() {
 | 
			
		||||
        return player;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void message(C c, String... args) {
 | 
			
		||||
        MainUtil.sendMessage(getSuperCaller(), c, args);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void sendRequiredArgumentsList(CommandManager manager, Command cmd, Argument[] required) {
 | 
			
		||||
        message(C.COMMAND_SYNTAX, cmd.getUsage());
 | 
			
		||||
        message("Argument list is yet to be implemented");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -29,9 +29,9 @@ import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.lang.StringUtils;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
@@ -119,9 +119,7 @@ public class list extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
        final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null;
 | 
			
		||||
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        if (args.length < 1) {
 | 
			
		||||
            noArgs(plr);
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -27,14 +27,14 @@ import java.net.URLConnection;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualsites.commands.CommandDeclaration;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
        command = "plugin",
 | 
			
		||||
@@ -70,7 +70,7 @@ public class plugin extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final CommandCaller caller, final String[] args) {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        TaskManager.runTaskAsync(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
@@ -85,7 +85,7 @@ public class plugin extends SubCommand {
 | 
			
		||||
                    }
 | 
			
		||||
                };
 | 
			
		||||
                for (final String s : strings) {
 | 
			
		||||
                    MainUtil.sendMessage(caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null, StringMan.replaceFromMap(s, C.replacements), false);
 | 
			
		||||
                    plr.sendMessage(s);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,8 @@ import org.bukkit.ChatColor;
 | 
			
		||||
import com.intellectualcrafters.configuration.ConfigurationSection;
 | 
			
		||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -689,4 +691,13 @@ public enum C {
 | 
			
		||||
    public String getCat() {
 | 
			
		||||
        return cat;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public void send(PlotPlayer plr, String... args) { 
 | 
			
		||||
        if (plr == null) {
 | 
			
		||||
            MainUtil.sendConsoleMessage(this, args);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            MainUtil.sendMessage(plr, this, args);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,126 @@
 | 
			
		||||
package com.intellectualcrafters.plot.object;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
 | 
			
		||||
 | 
			
		||||
public class ConsolePlayer implements PlotPlayer {
 | 
			
		||||
 | 
			
		||||
    private static ConsolePlayer instance;
 | 
			
		||||
    private Location loc;
 | 
			
		||||
    private final HashMap<String, Object> meta;
 | 
			
		||||
    
 | 
			
		||||
    public static ConsolePlayer getConsole() {
 | 
			
		||||
        if (instance == null) {
 | 
			
		||||
            instance = new ConsolePlayer();
 | 
			
		||||
        }
 | 
			
		||||
        return instance;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    private ConsolePlayer() {
 | 
			
		||||
        String world;
 | 
			
		||||
        Set<String> plotworlds = PS.get().getPlotWorlds();
 | 
			
		||||
        if (plotworlds.size() > 0) {
 | 
			
		||||
            world = plotworlds.iterator().next();
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            world = "world";
 | 
			
		||||
        }
 | 
			
		||||
        this.loc = new Location(world, 0, 0, 0);
 | 
			
		||||
        this.meta = new HashMap<>();
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean isConsole(PlotPlayer plr) {
 | 
			
		||||
        return instance == plr; 
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public long getPreviousLogin() {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Location getLocation() {
 | 
			
		||||
        return loc;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Location getLocationFull() {
 | 
			
		||||
        return loc;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public UUID getUUID() {
 | 
			
		||||
        return DBFunc.everyone;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasPermission(String perm) {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void sendMessage(String message) {
 | 
			
		||||
        PS.log(message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void teleport(Location loc) {
 | 
			
		||||
        this.loc = loc;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean isOp() {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean isOnline() {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return "*";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void setCompassTarget(Location loc) {}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void loadData() {}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void saveData() {}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void setAttribute(String key) {}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean getAttribute(String key) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void removeAttribute(String key) {}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void setMeta(String key, Object value) {
 | 
			
		||||
        this.meta.put(key, value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Object getMeta(String key) {
 | 
			
		||||
        return this.meta.get(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deleteMeta(String key) {
 | 
			
		||||
        this.meta.remove(key);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
@@ -606,6 +606,9 @@ public class Plot {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        final Plot other = (Plot) obj;
 | 
			
		||||
        if (this.hashCode() != other.hashCode()) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        return ((this.id.x.equals(other.id.x)) && (this.id.y.equals(other.id.y)) && (this.world.equals(other.world)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
import com.intellectualsites.commands.CommandCaller;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.plotsquared.bukkit.listeners.PlotListener;
 | 
			
		||||
import com.intellectualcrafters.plot.object.BlockLoc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.ChunkLoc;
 | 
			
		||||
@@ -1421,15 +1421,6 @@ public class MainUtil {
 | 
			
		||||
        return sendMessage(plr, msg, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static boolean sendCallerMessage(final CommandCaller plr, final String msg) {
 | 
			
		||||
        if (plr.getSuperCaller() instanceof PlotPlayer) {
 | 
			
		||||
            sendMessage((PlotPlayer) plr.getSuperCaller(), msg);
 | 
			
		||||
        } else {
 | 
			
		||||
            sendConsoleMessage(msg);
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void sendConsoleMessage(String msg) {
 | 
			
		||||
        sendMessage(null, msg);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1516,15 +1507,6 @@ public class MainUtil {
 | 
			
		||||
        return lines.toArray(new String[lines.size()]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static boolean sendCallerMessage(final CommandCaller caller, final C c, final String... args) {
 | 
			
		||||
        if (caller.getSuperCaller() instanceof PlotPlayer) {
 | 
			
		||||
            sendMessage((PlotPlayer) caller.getSuperCaller(), c, args);
 | 
			
		||||
        } else {
 | 
			
		||||
            sendConsoleMessage(c, args);
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Send a message to the player
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -152,22 +152,48 @@ public class StringMan {
 | 
			
		||||
    
 | 
			
		||||
    public static String join(Object[] array, String delimiter) {
 | 
			
		||||
        StringBuilder result = new StringBuilder();
 | 
			
		||||
        System.out.print(array.getClass().getName());
 | 
			
		||||
        for (int i = 0, j = array.length; i < j; i++) {
 | 
			
		||||
            if (i > 0) {
 | 
			
		||||
                result.append(delimiter);
 | 
			
		||||
            }
 | 
			
		||||
            System.out.print(array[i].getClass().getName());
 | 
			
		||||
            result.append(array[i]);
 | 
			
		||||
        }
 | 
			
		||||
        return result.toString();
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static String join(int[] array, String delimiter) {
 | 
			
		||||
        return join(Arrays.asList(array), delimiter);
 | 
			
		||||
        Integer[] wrapped = new Integer[array.length];
 | 
			
		||||
        for (int i = 0; i < array.length; i++) wrapped[i] = array[i];
 | 
			
		||||
        return join(wrapped, delimiter);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean isEqual(String a, String b ) {
 | 
			
		||||
    public static boolean isEqualToAny(String a, String... args) {
 | 
			
		||||
        for (String arg : args) {
 | 
			
		||||
            if (StringMan.isEqual(a, arg)) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean isEqualIgnoreCaseToAny(String a, String... args) {
 | 
			
		||||
        for (String arg : args) {
 | 
			
		||||
            if (StringMan.isEqualIgnoreCase(a, arg)) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean isEqual(String a, String b) {
 | 
			
		||||
        return (a == b || (a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b)));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean isEqualIgnoreCase(String a, String b) {
 | 
			
		||||
        return (a == b || (a.length() == b.length() && a.equalsIgnoreCase(b)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String repeat(String s, int n) {
 | 
			
		||||
        final StringBuilder sb = new StringBuilder();
 | 
			
		||||
 
 | 
			
		||||
@@ -79,8 +79,8 @@ public class UUIDHandler {
 | 
			
		||||
        implementation.setUUIDWrapper(wrapper);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void startCaching() {
 | 
			
		||||
        implementation.startCaching();
 | 
			
		||||
    public static void startCaching(Runnable whenDone) {
 | 
			
		||||
        implementation.startCaching(whenDone);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void cache(final BiMap<StringWrapper, UUID> toAdd) {
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ public abstract class UUIDHandlerImplementation {
 | 
			
		||||
     * Start UUID caching (this should be an async task)
 | 
			
		||||
     * Recommended to override this is you want to cache offline players
 | 
			
		||||
     */
 | 
			
		||||
    public boolean startCaching() {
 | 
			
		||||
    public boolean startCaching(Runnable whenDone) {
 | 
			
		||||
        if (CACHED) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
@@ -55,6 +55,11 @@ public abstract class UUIDHandlerImplementation {
 | 
			
		||||
        this.uuidWrapper = wrapper;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public void rename(UUID uuid, StringWrapper name) {
 | 
			
		||||
        uuidMap.inverse().remove(uuid);
 | 
			
		||||
        uuidMap.put(name, uuid);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public void add(final BiMap<StringWrapper, UUID> toAdd) {
 | 
			
		||||
        if (uuidMap.size() == 0) {
 | 
			
		||||
            uuidMap = toAdd;
 | 
			
		||||
@@ -63,7 +68,20 @@ public abstract class UUIDHandlerImplementation {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                for (Map.Entry<StringWrapper, UUID> entry : toAdd.entrySet()) {
 | 
			
		||||
                    add(entry.getKey(), entry.getValue());
 | 
			
		||||
                    UUID uuid = entry.getValue();
 | 
			
		||||
                    StringWrapper name = entry.getKey();
 | 
			
		||||
                    if ((uuid == null) || (name == null)) {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    BiMap<UUID, StringWrapper> inverse = uuidMap.inverse();
 | 
			
		||||
                    if (inverse.containsKey(uuid)) {
 | 
			
		||||
                        if (uuidMap.containsKey(name)) {
 | 
			
		||||
                            continue;
 | 
			
		||||
                        }
 | 
			
		||||
                        rename(uuid, name);
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    uuidMap.put(name, uuid);
 | 
			
		||||
                }
 | 
			
		||||
                PS.log(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
 | 
			
		||||
            }
 | 
			
		||||
@@ -79,7 +97,8 @@ public abstract class UUIDHandlerImplementation {
 | 
			
		||||
            if (uuidMap.containsKey(name)) {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            inverse.remove(uuid);
 | 
			
		||||
            rename(uuid, name);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        uuidMap.put(name, uuid);
 | 
			
		||||
        return true;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user