mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-30 00:56:45 +01:00
parent
82ccca8f63
commit
f102b2b448
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>3.2.21</version>
|
<version>3.2.22</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -22,20 +22,17 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "clear", description = "Clear a plot", permission = "plots.clear", category = CommandCategory.ACTIONS, usage = "/plot clear [id]")
|
@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) {
|
public boolean onCommand(final PlotPlayer plr, final String... args) {
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot;
|
final Plot plot;
|
||||||
if (args.length == 2) {
|
if (args.length == 1) {
|
||||||
final PlotId id = PlotId.fromString(args[0]);
|
if (args[0].equalsIgnoreCase("mine")) {
|
||||||
if (id == null) {
|
Set<Plot> plots = plr.getPlots();
|
||||||
if (args[1].equalsIgnoreCase("mine")) {
|
if (plots.size() > 0) {
|
||||||
final Set<Plot> plots = PS.get().getPlots(plr);
|
plot = plots.iterator().next();
|
||||||
if (plots.size() == 0) {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot = plots.iterator().next();
|
} else {
|
||||||
|
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 {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot clear [X;Z|mine]");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot clear [X;Z|mine]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
if ((!plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
|
||||||
plot = MainUtil.getPlotAbs(loc.getWorld(), id);
|
|
||||||
}
|
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
// 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")) {
|
|
||||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
}
|
}
|
||||||
if (plot.getRunning() != 0) {
|
if (plot.getRunning() != 0) {
|
||||||
|
@ -26,7 +26,6 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.plotsquared.general.commands.Argument;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -39,10 +38,6 @@ usage = "/plot copy <X;Z>",
|
|||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Copy extends SubCommand {
|
public class Copy extends SubCommand {
|
||||||
|
|
||||||
public Copy() {
|
|
||||||
requiredArguments = new Argument[] { Argument.PlotID };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
|
@ -26,12 +26,11 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
@ -205,22 +204,33 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onCommand(final PlotPlayer player, final String cmd, String... args) {
|
public static boolean onCommand(final PlotPlayer player, final String cmd, String... args) {
|
||||||
|
// Clear perm caching //
|
||||||
|
player.deleteMeta("perm");
|
||||||
|
////////////////////////
|
||||||
int help_index = -1;
|
int help_index = -1;
|
||||||
String category = null;
|
String category = null;
|
||||||
if (args.length == 0) {
|
Location loc = null;
|
||||||
help_index = 0;
|
|
||||||
} else if (StringMan.isEqualIgnoreCaseToAny(args[0], "he", "help", "?")) {
|
|
||||||
help_index = 0;
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 3: {
|
case 0: {
|
||||||
category = args[1];
|
help_index = 0;
|
||||||
if (MathMan.isInteger(args[2])) {
|
break;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
if (MathMan.isInteger(args[0])) {
|
||||||
try {
|
try {
|
||||||
help_index = Integer.parseInt(args[2]);
|
help_index = Integer.parseInt(args[args.length - 1]);
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {}
|
||||||
help_index = 1;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
switch (args[0].toLowerCase()) {
|
||||||
|
case "he":
|
||||||
|
case "help":
|
||||||
|
case "?": {
|
||||||
|
switch (args.length) {
|
||||||
|
case 1: {
|
||||||
|
help_index = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
@ -237,33 +247,41 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
case 3: {
|
||||||
} else if ((args.length == 1) && MathMan.isInteger(args[args.length - 1])) {
|
category = args[1];
|
||||||
|
if (MathMan.isInteger(args[2])) {
|
||||||
try {
|
try {
|
||||||
help_index = Integer.parseInt(args[args.length - 1]);
|
help_index = Integer.parseInt(args[2]);
|
||||||
} catch (final NumberFormatException e) {}
|
} catch (final NumberFormatException e) {
|
||||||
} else if (ConsolePlayer.isConsole(player) && (args.length >= 2)) {
|
help_index = 1;
|
||||||
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);
|
break;
|
||||||
if (plot != null) {
|
}
|
||||||
player.teleport(plot.getBottomAbs());
|
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);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (help_index != -1) {
|
if (help_index != -1) {
|
||||||
displayHelp(player, category, help_index, cmd);
|
displayHelp(player, category, help_index, cmd);
|
||||||
@ -274,6 +292,9 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
}
|
}
|
||||||
String fullCmd = StringMan.join(args, " ");
|
String fullCmd = StringMan.join(args, " ");
|
||||||
getInstance().handle(player, cmd + " " + fullCmd);
|
getInstance().handle(player, cmd + " " + fullCmd);
|
||||||
|
if (loc != null) {
|
||||||
|
player.setMeta("location", loc);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,9 +341,6 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int handle(final PlotPlayer plr, final String input) {
|
public int handle(final PlotPlayer plr, final String input) {
|
||||||
// Clear perm caching //
|
|
||||||
plr.deleteMeta("perm");
|
|
||||||
////////////////////////
|
|
||||||
final String[] parts = input.split(" ");
|
final String[] parts = input.split(" ");
|
||||||
String[] args;
|
String[] args;
|
||||||
String label;
|
String label;
|
||||||
|
@ -26,7 +26,6 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.plotsquared.general.commands.Argument;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -39,10 +38,6 @@ category = CommandCategory.ACTIONS,
|
|||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Move extends SubCommand {
|
public class Move extends SubCommand {
|
||||||
|
|
||||||
public Move() {
|
|
||||||
requiredArguments = new Argument[] { Argument.PlotID };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
|
@ -49,7 +49,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The plot class
|
* The plot class
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class Plot {
|
public class Plot {
|
||||||
@ -74,8 +73,9 @@ public class Plot {
|
|||||||
public UUID owner;
|
public UUID owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot creation timestamp (rough)
|
* Plot creation timestamp (not accurate if the plot was created before this was implemented)<br>
|
||||||
* Direct access is Deprecated: use getTimestamp()
|
* - Milliseconds since the epoch<br>
|
||||||
|
* Direct access is Deprecated: use {@link #getTimestamp() getTimestamp}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public long timestamp;
|
public long timestamp;
|
||||||
@ -171,6 +171,23 @@ public class Plot {
|
|||||||
return MainUtil.getPlot(world, id);
|
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
|
* Return a new/cached plot object at a given location
|
||||||
*
|
*
|
||||||
@ -250,7 +267,9 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the metadata for a key
|
* Get the metadata for a key<br>
|
||||||
|
* <br>
|
||||||
|
* For persistent metadata use the flag system
|
||||||
* @param key
|
* @param key
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -275,7 +294,7 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the cluster this plot is associated with
|
* Get the cluster this plot is associated with
|
||||||
* @return
|
* @return the PlotCluster object, or null
|
||||||
*/
|
*/
|
||||||
public PlotCluster getCluster() {
|
public PlotCluster getCluster() {
|
||||||
if (!Settings.ENABLE_CLUSTERS) {
|
if (!Settings.ENABLE_CLUSTERS) {
|
||||||
@ -311,8 +330,10 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Efficiently get the players currently inside this plot
|
* Efficiently get the players currently inside this plot<br>
|
||||||
* @return
|
* - 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() {
|
public List<PlotPlayer> getPlayersInPlot() {
|
||||||
return MainUtil.getPlayersInPlot(this);
|
return MainUtil.getPlayersInPlot(this);
|
||||||
@ -327,6 +348,11 @@ public class Plot {
|
|||||||
return owner != null;
|
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) {
|
public boolean isOwner(final UUID uuid) {
|
||||||
return PlotHandler.isOwner(this, uuid);
|
return PlotHandler.isOwner(this, uuid);
|
||||||
}
|
}
|
||||||
@ -370,7 +396,7 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot world object for this plot<br>
|
* Get the plot world object for this plot<br>
|
||||||
* - The generic PlotWorld object can be casted to it's respective class for more control
|
* - The generic PlotWorld object can be casted to its respective class for more control (e.g. HybridPlotWorld)
|
||||||
* @return PlotWorld
|
* @return PlotWorld
|
||||||
*/
|
*/
|
||||||
public PlotWorld getWorld() {
|
public PlotWorld getWorld() {
|
||||||
@ -379,7 +405,7 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot manager object for this plot<br>
|
* Get the plot manager object for this plot<br>
|
||||||
* - The generic PlotManager object can be casted to it's respective class for more control
|
* - The generic PlotManager object can be casted to its respective class for more control (e.g. HybridPlotManager)
|
||||||
* @return PlotManager
|
* @return PlotManager
|
||||||
*/
|
*/
|
||||||
public PlotManager getManager() {
|
public PlotManager getManager() {
|
||||||
@ -450,7 +476,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the plot is merged
|
* Check if the plot is merged in any direction
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isMerged() {
|
public boolean isMerged() {
|
||||||
@ -461,7 +487,9 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the timestamp in milliseconds of when the plot was created (unreliable)
|
* 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
|
* @return
|
||||||
*/
|
*/
|
||||||
public long getTimestamp() {
|
public long getTimestamp() {
|
||||||
@ -472,9 +500,21 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the plot is merged in a direction
|
* 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
|
* @param direction
|
||||||
* @return
|
* @return true if merged in that direction
|
||||||
*/
|
*/
|
||||||
public boolean getMerged(final int direction) {
|
public boolean getMerged(final int direction) {
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
@ -536,7 +576,6 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deny someone (updates database as well)
|
* Deny someone (updates database as well)
|
||||||
*
|
|
||||||
* @param uuid
|
* @param uuid
|
||||||
*/
|
*/
|
||||||
public void addDenied(final UUID 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 itself for the top/bottom<br>
|
* - If the plot is not connected, it will return its own corners<br>
|
||||||
* - the returned IDs will not necessarily correspond to claimed plots if the connected plots do not form a rectangular shape
|
* - 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
|
* @deprecated as merged plots no longer need to be rectangular
|
||||||
* @param plot
|
* @param plot
|
||||||
* @return new PlotId[] { bottom, top }
|
* @return new Location[] { bottom, top }
|
||||||
* @see MainUtil#getCornerIds(Plot)
|
* @see MainUtil#getCorners(Plot)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Location[] getCorners() {
|
public Location[] getCorners() {
|
||||||
@ -917,7 +956,21 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated in favor of getCorners()[0];
|
* 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
|
* @return
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -945,8 +998,9 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will combine each plot into effective rectangular regions
|
* This will combine each plot into effective rectangular regions<br>
|
||||||
* - This result is cached globally
|
* - This result is cached globally<br>
|
||||||
|
* - Useful for handling non rectangular shapes
|
||||||
* @see MainUtil#getRegions(Plot)
|
* @see MainUtil#getRegions(Plot)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -1005,8 +1059,8 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a denied player (use DBFunc as well)
|
* Remove a denied player (use DBFunc as well)<br>
|
||||||
*
|
* Using the * uuid will remove all users
|
||||||
* @param uuid
|
* @param uuid
|
||||||
*/
|
*/
|
||||||
public boolean removeDenied(final UUID uuid) {
|
public boolean removeDenied(final UUID uuid) {
|
||||||
@ -1021,8 +1075,8 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a helper (use DBFunc as well)
|
* Remove a helper (use DBFunc as well)<br>
|
||||||
*
|
* Using the * uuid will remove all users
|
||||||
* @param uuid
|
* @param uuid
|
||||||
*/
|
*/
|
||||||
public boolean removeTrusted(final UUID uuid) {
|
public boolean removeTrusted(final UUID uuid) {
|
||||||
@ -1037,8 +1091,8 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a trusted user (use DBFunc as well)
|
* Remove a trusted user (use DBFunc as well)<br>
|
||||||
*
|
* Using the * uuid will remove all users
|
||||||
* @param uuid
|
* @param uuid
|
||||||
*/
|
*/
|
||||||
public boolean removeMember(final UUID uuid) {
|
public boolean removeMember(final UUID uuid) {
|
||||||
@ -1098,7 +1152,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload the plot to the configured web interface
|
* Upload the plot as a schematic to the configured web interface
|
||||||
* @param whenDone value will be null if uploading fails
|
* @param whenDone value will be null if uploading fails
|
||||||
*/
|
*/
|
||||||
public void upload(final RunnableVal<URL> whenDone) {
|
public void upload(final RunnableVal<URL> whenDone) {
|
||||||
@ -1147,6 +1201,11 @@ public class Plot {
|
|||||||
return id.hashCode();
|
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() {
|
public HashMap<String, Flag> getFlags() {
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
return new HashMap<>(0);
|
return new HashMap<>(0);
|
||||||
@ -1154,6 +1213,11 @@ public class Plot {
|
|||||||
return settings.flags;
|
return settings.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plot Alias<br>
|
||||||
|
* - Returns an empty string if no alias is set
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getAlias() {
|
public String getAlias() {
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
return "";
|
return "";
|
||||||
@ -1163,8 +1227,16 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the raw merge data<br>
|
* Set the raw merge data<br>
|
||||||
* - Updates DB
|
* - Updates DB<br>
|
||||||
* - Does not modify terrain
|
* - 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
|
* @param merged
|
||||||
*/
|
*/
|
||||||
public void setMerged(boolean[] 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
|
* - Updates DB<br>
|
||||||
* - Does not modify terrain
|
* - Does not modify terrain<br>
|
||||||
|
* ----------<br>
|
||||||
|
* 0 = north<br>
|
||||||
|
* 1 = east<br>
|
||||||
|
* 2 = south<br>
|
||||||
|
* 3 = west<br>
|
||||||
|
* ----------<br>
|
||||||
* @param merged
|
* @param merged
|
||||||
*/
|
*/
|
||||||
public void setMerged(int direction, boolean value) {
|
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() {
|
public boolean[] getMerged() {
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
return new boolean[] {false, false, false, false };
|
return new boolean[] {false, false, false, false };
|
||||||
@ -1215,6 +1297,13 @@ public class Plot {
|
|||||||
return settings.getMerged();
|
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() {
|
public BlockLoc getPosition() {
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
return new BlockLoc(0, 0, 0);
|
return new BlockLoc(0, 0, 0);
|
||||||
|
@ -17,8 +17,8 @@ import com.plotsquared.general.commands.CommandCaller;
|
|||||||
import com.plotsquared.listener.PlotListener;
|
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 {
|
public abstract class PlotPlayer implements CommandCaller {
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ public abstract class PlotPlayer implements CommandCaller {
|
|||||||
private ConcurrentHashMap<String, Object> meta;
|
private ConcurrentHashMap<String, Object> meta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Efficiently wrap a Player object to get a PlotPlayer (or fetch if it's already cached)<br>
|
* 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 sponge/bukkit Player (online)
|
||||||
* - Accepts player name (online)
|
* - Accepts player name (online)
|
||||||
* - Accepts UUID
|
* - 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 just logged in or is not online
|
* - This will return null if the player has not finished logging in or is not online
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user