mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-03 18:53:43 +01:00 
			
		
		
		
	@@ -22,20 +22,17 @@ package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.FlagManager;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotId;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.CmdConfirm;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(command = "clear", description = "Clear a plot", permission = "plots.clear", category = CommandCategory.ACTIONS, usage = "/plot clear [id]")
 | 
			
		||||
@@ -45,34 +42,34 @@ public class Clear extends SubCommand {
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String... args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot;
 | 
			
		||||
        if (args.length == 2) {
 | 
			
		||||
            final PlotId id = PlotId.fromString(args[0]);
 | 
			
		||||
            if (id == null) {
 | 
			
		||||
                if (args[1].equalsIgnoreCase("mine")) {
 | 
			
		||||
                    final Set<Plot> plots = PS.get().getPlots(plr);
 | 
			
		||||
                    if (plots.size() == 0) {
 | 
			
		||||
                        MainUtil.sendMessage(plr, C.NO_PLOTS);
 | 
			
		||||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
        if (args.length == 1) {
 | 
			
		||||
            if (args[0].equalsIgnoreCase("mine")) {
 | 
			
		||||
                Set<Plot> plots = plr.getPlots();
 | 
			
		||||
                if (plots.size() > 0) {
 | 
			
		||||
                    plot = plots.iterator().next();
 | 
			
		||||
                } else {
 | 
			
		||||
                    MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot clear [X;Z|mine]");
 | 
			
		||||
                    MainUtil.sendMessage(plr, C.NO_PLOTS);
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                plot = MainUtil.getPlotAbs(loc.getWorld(), id);
 | 
			
		||||
                plot = MainUtil.getPlotFromString(plr, args[0], true);
 | 
			
		||||
            }
 | 
			
		||||
            if (plot == null) {
 | 
			
		||||
                MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot clear [X;Z|mine]");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        } else if (args.length == 0) {
 | 
			
		||||
            plot = MainUtil.getPlotAbs(loc);
 | 
			
		||||
            if (plot == null) {
 | 
			
		||||
                MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot clear [X;Z|mine]");
 | 
			
		||||
                C.NOT_IN_PLOT.send(plr);
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            plot = MainUtil.getPlotAbs(loc);
 | 
			
		||||
        }
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot clear [X;Z|mine]");
 | 
			
		||||
            return sendMessage(plr, C.NOT_IN_PLOT);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        //        if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
 | 
			
		||||
        //            return sendMessage(plr, C.UNLINK_REQUIRED);
 | 
			
		||||
        //        }
 | 
			
		||||
        if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
 | 
			
		||||
        if ((!plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
 | 
			
		||||
            return sendMessage(plr, C.NO_PLOT_PERMS);
 | 
			
		||||
        }
 | 
			
		||||
        if (plot.getRunning() != 0) {
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,6 @@ import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.plotsquared.general.commands.Argument;
 | 
			
		||||
import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
@@ -39,10 +38,6 @@ usage = "/plot copy <X;Z>",
 | 
			
		||||
requiredType = RequiredType.NONE)
 | 
			
		||||
public class Copy extends SubCommand {
 | 
			
		||||
    
 | 
			
		||||
    public Copy() {
 | 
			
		||||
        requiredArguments = new Argument[] { Argument.PlotID };
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
 
 | 
			
		||||
@@ -26,12 +26,11 @@ import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
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.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotId;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MathMan;
 | 
			
		||||
@@ -205,65 +204,84 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
        new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages().generatePage(page, label).render();
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean onCommand(final PlotPlayer player, final String cmd, String... args) {
 | 
			
		||||
        // Clear perm caching //
 | 
			
		||||
        player.deleteMeta("perm");
 | 
			
		||||
        ////////////////////////
 | 
			
		||||
        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];
 | 
			
		||||
                    if (MathMan.isInteger(args[2])) {
 | 
			
		||||
                        try {
 | 
			
		||||
                            help_index = Integer.parseInt(args[2]);
 | 
			
		||||
                        } catch (final NumberFormatException e) {
 | 
			
		||||
                            help_index = 1;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case 2: {
 | 
			
		||||
                    if (MathMan.isInteger(args[1])) {
 | 
			
		||||
                        category = null;
 | 
			
		||||
                        try {
 | 
			
		||||
                            help_index = Integer.parseInt(args[1]);
 | 
			
		||||
                        } catch (final NumberFormatException e) {
 | 
			
		||||
                            help_index = 1;
 | 
			
		||||
                        }
 | 
			
		||||
                    } else {
 | 
			
		||||
                        help_index = 1;
 | 
			
		||||
                        category = args[1];
 | 
			
		||||
        String category = null;
 | 
			
		||||
        Location loc = null;
 | 
			
		||||
        switch (args.length) {
 | 
			
		||||
            case 0: {
 | 
			
		||||
                help_index = 0;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            case 1: {
 | 
			
		||||
                if (MathMan.isInteger(args[0])) {
 | 
			
		||||
                    try {
 | 
			
		||||
                        help_index = Integer.parseInt(args[args.length - 1]);
 | 
			
		||||
                    } catch (final NumberFormatException e) {}
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } else if ((args.length == 1) && MathMan.isInteger(args[args.length - 1])) {
 | 
			
		||||
            try {
 | 
			
		||||
                help_index = Integer.parseInt(args[args.length - 1]);
 | 
			
		||||
            } catch (final NumberFormatException e) {}
 | 
			
		||||
        } else if (ConsolePlayer.isConsole(player) && (args.length >= 2)) {
 | 
			
		||||
            final String[] split = args[0].split(";");
 | 
			
		||||
            String world;
 | 
			
		||||
            PlotId id;
 | 
			
		||||
            if (split.length == 2) {
 | 
			
		||||
                world = player.getLocation().getWorld();
 | 
			
		||||
                id = PlotId.fromString(split[0] + ";" + split[1]);
 | 
			
		||||
            } else if (split.length == 3) {
 | 
			
		||||
                world = split[0];
 | 
			
		||||
                id = PlotId.fromString(split[1] + ";" + split[2]);
 | 
			
		||||
            } else {
 | 
			
		||||
                id = null;
 | 
			
		||||
                world = null;
 | 
			
		||||
            }
 | 
			
		||||
            if ((id != null) && PS.get().isPlotWorld(world)) {
 | 
			
		||||
                final Plot plot = MainUtil.getPlotAbs(world, id);
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    player.teleport(plot.getBottomAbs());
 | 
			
		||||
            }
 | 
			
		||||
            default: {
 | 
			
		||||
                switch (args[0].toLowerCase()) {
 | 
			
		||||
                    case "he":
 | 
			
		||||
                    case "help":
 | 
			
		||||
                    case "?": {
 | 
			
		||||
                        switch (args.length) {
 | 
			
		||||
                            case 1: {
 | 
			
		||||
                                help_index = 0;
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            case 2: {
 | 
			
		||||
                                if (MathMan.isInteger(args[1])) {
 | 
			
		||||
                                    category = null;
 | 
			
		||||
                                    try {
 | 
			
		||||
                                        help_index = Integer.parseInt(args[1]);
 | 
			
		||||
                                    } catch (final NumberFormatException e) {
 | 
			
		||||
                                        help_index = 1;
 | 
			
		||||
                                    }
 | 
			
		||||
                                } else {
 | 
			
		||||
                                    help_index = 1;
 | 
			
		||||
                                    category = args[1];
 | 
			
		||||
                                }
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            case 3: {
 | 
			
		||||
                                category = args[1];
 | 
			
		||||
                                if (MathMan.isInteger(args[2])) {
 | 
			
		||||
                                    try {
 | 
			
		||||
                                        help_index = Integer.parseInt(args[2]);
 | 
			
		||||
                                    } catch (final NumberFormatException e) {
 | 
			
		||||
                                        help_index = 1;
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            default: {
 | 
			
		||||
                                C.COMMAND_SYNTAX.send(player, "/" + cmd + "? [#|<term>|category [#]]");
 | 
			
		||||
                                return true;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                    default: {
 | 
			
		||||
                        if (args.length >= 2) {
 | 
			
		||||
                            String world = player.getLocation().getWorld();
 | 
			
		||||
                            Plot plot = Plot.fromString(world, args[0]);
 | 
			
		||||
                            if (plot == null) {
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            if (!ConsolePlayer.isConsole(player) && (!plot.world.equals(world) || plot.isDenied(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN)) {
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            loc = (Location) player.getMeta("location");
 | 
			
		||||
                            player.setMeta("location", plot.getBottomAbs());
 | 
			
		||||
                            args = Arrays.copyOfRange(args, 1, args.length);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (help_index != -1) {
 | 
			
		||||
@@ -274,6 +292,9 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
            args[0] = args[0].replaceFirst(":", " ");
 | 
			
		||||
        }
 | 
			
		||||
        String fullCmd = StringMan.join(args, " ");
 | 
			
		||||
        getInstance().handle(player, cmd + " " + fullCmd);
 | 
			
		||||
        if (loc != null) {
 | 
			
		||||
            player.setMeta("location", loc);
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
@@ -320,9 +341,6 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public int handle(final PlotPlayer plr, final String input) {
 | 
			
		||||
        // Clear perm caching //
 | 
			
		||||
        plr.deleteMeta("perm");
 | 
			
		||||
    public int handle(final PlotPlayer plr, final String input) {
 | 
			
		||||
        final String[] parts = input.split(" ");
 | 
			
		||||
        String[] args;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,6 @@ import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.plotsquared.general.commands.Argument;
 | 
			
		||||
import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
@@ -39,10 +38,6 @@ category = CommandCategory.ACTIONS,
 | 
			
		||||
requiredType = RequiredType.NONE)
 | 
			
		||||
public class Move extends SubCommand {
 | 
			
		||||
    
 | 
			
		||||
    public Move() {
 | 
			
		||||
        requiredArguments = new Argument[] { Argument.PlotID };
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The plot class
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
@SuppressWarnings("javadoc")
 | 
			
		||||
public class Plot {
 | 
			
		||||
@@ -74,8 +73,9 @@ public class Plot {
 | 
			
		||||
    public UUID owner;
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Plot creation timestamp (not accurate if the plot was created before this was implemented)<br>
 | 
			
		||||
     *  - Milliseconds since the epoch<br>
 | 
			
		||||
     * Direct access is Deprecated: use {@link #getTimestamp() getTimestamp}
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public long timestamp;
 | 
			
		||||
@@ -171,6 +171,23 @@ public class Plot {
 | 
			
		||||
        return MainUtil.getPlot(world, id);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static Plot fromString(String defaultWorld, String string) {
 | 
			
		||||
        final String[] split = string.split(";|,");
 | 
			
		||||
        if (split.length == 2) {
 | 
			
		||||
            if (PS.get().isPlotWorld(defaultWorld)) {
 | 
			
		||||
                PlotId id = PlotId.fromString(split[0] + ";" + split[1]);
 | 
			
		||||
                return Plot.getPlot(defaultWorld, id);
 | 
			
		||||
            }
 | 
			
		||||
        } else if (split.length == 3) {
 | 
			
		||||
            defaultWorld = split[0];
 | 
			
		||||
            if (PS.get().isPlotWorld(defaultWorld)) {
 | 
			
		||||
                PlotId id = PlotId.fromString(split[1] + ";" + split[2]);
 | 
			
		||||
                return Plot.getPlot(defaultWorld, id);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Return a new/cached plot object at a given location
 | 
			
		||||
     *
 | 
			
		||||
@@ -250,7 +267,9 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
     * Get the metadata for a key<br>
 | 
			
		||||
     * <br>
 | 
			
		||||
     * For persistent metadata use the flag system
 | 
			
		||||
     * @param key
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
@@ -275,7 +294,7 @@ public class Plot {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the cluster this plot is associated with
 | 
			
		||||
    /**
 | 
			
		||||
     * @return the PlotCluster object, or null
 | 
			
		||||
     */
 | 
			
		||||
    public PlotCluster getCluster() {
 | 
			
		||||
        if (!Settings.ENABLE_CLUSTERS) {
 | 
			
		||||
@@ -311,8 +330,10 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Efficiently get the players currently inside this plot<br>
 | 
			
		||||
     *  - Will return an empty list if no players are in the plot<br>
 | 
			
		||||
     *  - Remember, you can cast a PlotPlayer to it's respective implementation (BukkitPlayer, SpongePlayer) to obtain the player object
 | 
			
		||||
     * @return list of PlotPlayer(s) or an empty list
 | 
			
		||||
     */
 | 
			
		||||
    public List<PlotPlayer> getPlayersInPlot() {
 | 
			
		||||
        return MainUtil.getPlayersInPlot(this);
 | 
			
		||||
@@ -327,6 +348,11 @@ public class Plot {
 | 
			
		||||
        return owner != null;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Check if a UUID is a plot owner (merged plots may have multiple owners)
 | 
			
		||||
     * @param uuid
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isOwner(final UUID uuid) {
 | 
			
		||||
        return PlotHandler.isOwner(this, uuid);
 | 
			
		||||
    }
 | 
			
		||||
@@ -370,7 +396,7 @@ public class Plot {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the plot world object for this plot<br>
 | 
			
		||||
    /**
 | 
			
		||||
     *  - The generic PlotWorld object can be casted to its respective class for more control (e.g. HybridPlotWorld)
 | 
			
		||||
     * @return PlotWorld
 | 
			
		||||
     */
 | 
			
		||||
    public PlotWorld getWorld() {
 | 
			
		||||
@@ -379,7 +405,7 @@ public class Plot {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the plot manager object for this plot<br>
 | 
			
		||||
    /**
 | 
			
		||||
     *  - The generic PlotManager object can be casted to its respective class for more control (e.g. HybridPlotManager)
 | 
			
		||||
     * @return PlotManager
 | 
			
		||||
     */
 | 
			
		||||
    public PlotManager getManager() {
 | 
			
		||||
@@ -450,7 +476,7 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
     * Check if the plot is merged in any direction
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isMerged() {
 | 
			
		||||
@@ -461,7 +487,9 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
     * Get the timestamp of when the plot was created (unreliable)<br>
 | 
			
		||||
     * - not accurate if the plot was created before this was implemented<br>
 | 
			
		||||
     *  - Milliseconds since the epoch<br>
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public long getTimestamp() {
 | 
			
		||||
@@ -472,9 +500,21 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
     * Get if the plot is merged in a direction<br>
 | 
			
		||||
     * ------- Actual -------<br>
 | 
			
		||||
     * 0 = north<br>
 | 
			
		||||
     * 1 = east<br>
 | 
			
		||||
     * 2 = south<br>
 | 
			
		||||
     * 3 = west<br>
 | 
			
		||||
     * ----- Artificial -----<br>
 | 
			
		||||
     * 4 = north-east<br>
 | 
			
		||||
     * 5 = south-east<br>
 | 
			
		||||
     * 6 = south-west<br>
 | 
			
		||||
     * 7 = north-west<br>
 | 
			
		||||
     * ----------<br>
 | 
			
		||||
     * Note: A plot that is merged north and east will not be merged northeast if the northeast plot is not part of the same group<br>
 | 
			
		||||
     * @param direction
 | 
			
		||||
     * Get if the plot is merged in a direction
 | 
			
		||||
     * @return true if merged in that direction
 | 
			
		||||
     */
 | 
			
		||||
    public boolean getMerged(final int direction) {
 | 
			
		||||
        if (settings == null) {
 | 
			
		||||
@@ -536,7 +576,6 @@ public class Plot {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Deny someone (updates database as well)
 | 
			
		||||
    /**
 | 
			
		||||
     * @param uuid
 | 
			
		||||
     */
 | 
			
		||||
    public void addDenied(final UUID uuid) {
 | 
			
		||||
@@ -903,13 +942,13 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the top and bottom connected plot.<br>
 | 
			
		||||
     * Returns the top and bottom location.<br>
 | 
			
		||||
     *  - If the plot is not connected, it will return its own corners<br>
 | 
			
		||||
     *  - the returned locations will not necessarily correspond to claimed plots if the connected plots do not form a rectangular shape
 | 
			
		||||
     * @deprecated as merged plots no longer need to be rectangular
 | 
			
		||||
     * @param plot
 | 
			
		||||
     * @deprecated as merged plots no longer need to be rectangular
 | 
			
		||||
     * @param plot
 | 
			
		||||
     * @return new Location[] { bottom, top }
 | 
			
		||||
     * @see MainUtil#getCorners(Plot)
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public Location[] getCorners() {
 | 
			
		||||
@@ -917,7 +956,21 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
     * Returns the top and bottom plot id.<br>
 | 
			
		||||
     *  - If the plot is not connected, it will return itself for the top/bottom<br>
 | 
			
		||||
     *  - the returned ids will not necessarily correspond to claimed plots if the connected plots do not form a rectangular shape
 | 
			
		||||
     * @deprecated as merged plots no longer need to be rectangular
 | 
			
		||||
     * @param plot
 | 
			
		||||
     * @return new Plot[] { bottom, top }
 | 
			
		||||
     * @see MainUtil#getCornerIds(Plot)
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public PlotId[] getCornerIds() {
 | 
			
		||||
        return MainUtil.getCornerIds(this);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @deprecated in favor of getCorners()[0];<br>
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
@@ -945,8 +998,9 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * This will combine each plot into effective rectangular regions<br>
 | 
			
		||||
     *  - This result is cached globally<br>
 | 
			
		||||
     *  - Useful for handling non rectangular shapes
 | 
			
		||||
     * @see MainUtil#getRegions(Plot) 
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
@@ -1005,8 +1059,8 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Remove a denied player (use DBFunc as well)<br>
 | 
			
		||||
     * Using the * uuid will remove all users
 | 
			
		||||
     * @param uuid
 | 
			
		||||
     */
 | 
			
		||||
    public boolean removeDenied(final UUID uuid) {
 | 
			
		||||
@@ -1021,8 +1075,8 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Remove a helper (use DBFunc as well)<br>
 | 
			
		||||
     * Using the * uuid will remove all users
 | 
			
		||||
     * @param uuid
 | 
			
		||||
     */
 | 
			
		||||
    public boolean removeTrusted(final UUID uuid) {
 | 
			
		||||
@@ -1037,8 +1091,8 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Remove a trusted user (use DBFunc as well)<br>
 | 
			
		||||
     * Using the * uuid will remove all users
 | 
			
		||||
     * @param uuid
 | 
			
		||||
     */
 | 
			
		||||
    public boolean removeMember(final UUID uuid) {
 | 
			
		||||
@@ -1098,7 +1152,7 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    
 | 
			
		||||
     * Upload the plot as a schematic to the configured web interface
 | 
			
		||||
     * @param whenDone value will be null if uploading fails
 | 
			
		||||
     */
 | 
			
		||||
    public void upload(final RunnableVal<URL> whenDone) {
 | 
			
		||||
@@ -1147,6 +1201,11 @@ public class Plot {
 | 
			
		||||
        return id.hashCode();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the flags specific to this plot<br>
 | 
			
		||||
     *  - Does not take default flags into account<br>
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public HashMap<String, Flag> getFlags() {
 | 
			
		||||
        if (settings == null) {
 | 
			
		||||
            return new HashMap<>(0);
 | 
			
		||||
@@ -1154,6 +1213,11 @@ public class Plot {
 | 
			
		||||
        return settings.flags;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the plot Alias<br>
 | 
			
		||||
     *  - Returns an empty string if no alias is set
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public String getAlias() {
 | 
			
		||||
        if (settings == null) {
 | 
			
		||||
            return "";
 | 
			
		||||
@@ -1163,8 +1227,16 @@ public class Plot {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set the raw merge data<br>
 | 
			
		||||
    /**
 | 
			
		||||
     * Set the raw merge data<br>
 | 
			
		||||
     *  - Updates DB<br>
 | 
			
		||||
     *  - Does not modify terrain<br>
 | 
			
		||||
     * Get if the plot is merged in a direction<br>
 | 
			
		||||
     * ----------<br>
 | 
			
		||||
     * 0 = north<br>
 | 
			
		||||
     * 1 = east<br>
 | 
			
		||||
     * 2 = south<br>
 | 
			
		||||
     * 3 = west<br>
 | 
			
		||||
     * ----------<br>
 | 
			
		||||
     * Note: Diagonal merging (4-7) must be done by merging the corresponding plots. 
 | 
			
		||||
     * @param merged
 | 
			
		||||
     */
 | 
			
		||||
    public void setMerged(boolean[] merged) {
 | 
			
		||||
@@ -1180,8 +1252,14 @@ public class Plot {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set the raw merge data<br>
 | 
			
		||||
    /**
 | 
			
		||||
     * Set the raw merge data<br>
 | 
			
		||||
     *  - Updates DB<br>
 | 
			
		||||
     *  - Does not modify terrain<br>
 | 
			
		||||
     * ----------<br>
 | 
			
		||||
     * 0 = north<br>
 | 
			
		||||
     * 1 = east<br>
 | 
			
		||||
     * 2 = south<br>
 | 
			
		||||
     * 3 = west<br>
 | 
			
		||||
     * ----------<br>
 | 
			
		||||
     * @param merged
 | 
			
		||||
     */
 | 
			
		||||
    public void setMerged(int direction, boolean value) {
 | 
			
		||||
@@ -1208,6 +1286,10 @@ public class Plot {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the merged array
 | 
			
		||||
     * @return boolean [ north, east, south, west ]
 | 
			
		||||
     */
 | 
			
		||||
    public boolean[] getMerged() {
 | 
			
		||||
        if (settings == null) {
 | 
			
		||||
            return new boolean[] {false, false, false, false };
 | 
			
		||||
@@ -1215,6 +1297,13 @@ public class Plot {
 | 
			
		||||
        return settings.getMerged();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the set home location or 0,0,0 if no location is set<br>
 | 
			
		||||
     *  - Does not take the default home location into account
 | 
			
		||||
     * @see MainUtil#getPlotHome(Plot)
 | 
			
		||||
     * @see #getHome()
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public BlockLoc getPosition() {
 | 
			
		||||
        if (settings == null) {
 | 
			
		||||
            return new BlockLoc(0, 0, 0);
 | 
			
		||||
 
 | 
			
		||||
@@ -17,8 +17,8 @@ import com.plotsquared.general.commands.CommandCaller;
 | 
			
		||||
import com.plotsquared.listener.PlotListener;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created 2015-02-20 for PlotSquared
 | 
			
		||||
 *
 | 
			
		||||
 * The PlotPlayer class<br>
 | 
			
		||||
 *  - Can cast to: BukkitPlayer / SpongePlayer, which are the current implementations<br>
 | 
			
		||||
 */
 | 
			
		||||
public abstract class PlotPlayer implements CommandCaller {
 | 
			
		||||
    
 | 
			
		||||
@@ -28,7 +28,7 @@ public abstract class PlotPlayer implements CommandCaller {
 | 
			
		||||
    private ConcurrentHashMap<String, Object> meta;
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
    /**
 | 
			
		||||
     * Efficiently wrap a Player, or OfflinePlayer object to get a PlotPlayer (or fetch if it's already cached)<br>
 | 
			
		||||
     *  - Accepts sponge/bukkit Player (online)
 | 
			
		||||
     *  - Accepts player name (online)
 | 
			
		||||
     *  - Accepts UUID
 | 
			
		||||
@@ -42,7 +42,7 @@ public abstract class PlotPlayer implements CommandCaller {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the cached PlotPlayer from a username<br>
 | 
			
		||||
     * Get the cached PlotPlayer from a username<br>
 | 
			
		||||
     *  - This will return null if the player has not finished logging in or is not online
 | 
			
		||||
     * @param name
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user