Update README / pom / merge with 8629c4a6f5

closes #809
This commit is contained in:
Jesse Boyd
2016-01-11 07:00:56 +11:00
parent 00b6158181
commit af79100f7d
79 changed files with 946 additions and 939 deletions

View File

@ -20,9 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
@ -35,6 +32,8 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.UUID;
@CommandDeclaration(
command = "add",
aliases = { "a" },
@ -87,7 +86,7 @@ public class Add extends SubCommand {
if (plot.removeTrusted(uuid)) {
plot.addMember(uuid);
} else {
if ((plot.getMembers().size() + plot.getTrusted().size()) >= PS.get().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
if ((plot.getMembers().size() + plot.getTrusted().size()) >= plot.getWorld().MAX_PLOT_MEMBERS) {
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
return false;
}

View File

@ -202,16 +202,12 @@ public class Auto extends SubCommand {
MainUtil.lastPlot.put(worldname, getNextPlot(getLastPlot(worldname), 1));
}
} else {
boolean lastPlot = true;
while (!br) {
final PlotId start = getNextPlot(getLastPlot(worldname), 1);
// Checking if the current set of plots is a viable option.
MainUtil.lastPlot.put(worldname, start);
if (lastPlot) {}
if ((PS.get().getPlot(worldname, start) != null) && (PS.get().getPlot(worldname, start).owner != null)) {
continue;
} else {
lastPlot = false;
}
final PlotId end = new PlotId((start.x + size_x) - 1, (start.y + size_z) - 1);
if (MainUtil.canClaim(plr, worldname, start, end)) {

View File

@ -20,8 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.Set;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.flag.Flag;
@ -35,6 +33,8 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.Set;
@CommandDeclaration(
command = "buy",
aliases = { "b" },
@ -97,7 +97,7 @@ public class Buy extends SubCommand {
EconHandler.manager.depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.owner), price);
final PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
if (owner != null) {
sendMessage(plr, C.PLOT_SOLD, plot.id + "", plr.getName(), price + "");
sendMessage(plr, C.PLOT_SOLD, plot.getId() + "", plr.getName(), price + "");
}
FlagManager.removePlotFlag(plot, "price");
}

View File

@ -64,11 +64,11 @@ public class Claim extends SubCommand {
MainUtil.teleportPlayer(player, loc, plot);
}
final String world = plot.world;
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final Plot plot2 = PS.get().getPlot(world, plot.id);
final PlotWorld plotworld = plot.getWorld();
final Plot plot2 = PS.get().getPlot(world, plot.getId());
if (plotworld.SCHEMATIC_ON_CLAIM) {
Schematic sch;
if (schematic.equals("")) {
if (schematic.isEmpty()) {
sch = SchematicHandler.manager.getSchematic(plotworld.SCHEMATIC_FILE);
} else {
sch = SchematicHandler.manager.getSchematic(schematic);
@ -110,7 +110,7 @@ public class Claim extends SubCommand {
if (!MainUtil.canClaim(plr, plot)) {
return sendMessage(plr, C.PLOT_IS_CLAIMED);
}
final PlotWorld world = PS.get().getPlotWorld(plot.world);
final PlotWorld world = plot.getWorld();
if ((EconHandler.manager != null) && world.USE_ECONOMY) {
final double cost = world.PLOT_PRICE;
if (cost > 0d) {

View File

@ -114,7 +114,7 @@ public class Clear extends SubCommand {
}
};
if (Settings.CONFIRM_CLEAR && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) {
CmdConfirm.addPending(plr, "/plot clear " + plot.id, runnable);
CmdConfirm.addPending(plr, "/plot clear " + plot.getId(), runnable);
} else {
TaskManager.runTask(runnable);
}

View File

@ -249,7 +249,7 @@ public class Cluster extends SubCommand {
return false;
}
}
final PlotWorld plotworld = PS.get().getPlotWorld(plr.getLocation().getWorld());
final PlotWorld plotworld = plr.getLocation().getPlotWorld();
if (plotworld.TYPE == 2) {
final ArrayList<Plot> toRemove = new ArrayList<>();
for (final Plot plot : PS.get().getPlotsInWorld(plr.getLocation().getWorld())) {

View File

@ -121,7 +121,7 @@ public class Condense extends SubCommand {
while ((start.x <= minimum_radius) && (start.y <= minimum_radius)) {
final Plot plot = MainUtil.getPlotAbs(worldname, start);
if (!plot.hasOwner()) {
free.add(plot.id);
free.add(plot.getId());
}
start = Auto.getNextPlot(start, 1);
}
@ -225,8 +225,8 @@ public class Condense extends SubCommand {
public Set<PlotId> getPlots(final Collection<Plot> plots, final int radius) {
final HashSet<PlotId> outside = new HashSet<>();
for (final Plot plot : plots) {
if ((plot.id.x > radius) || (plot.id.x < -radius) || (plot.id.y > radius) || (plot.id.y < -radius)) {
outside.add(plot.id);
if ((plot.getId().x > radius) || (plot.getId().x < -radius) || (plot.getId().y > radius) || (plot.getId().y < -radius)) {
outside.add(plot.getId());
}
}
return outside;

View File

@ -20,7 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.HybridUtils;
@ -47,7 +46,7 @@ public class CreateRoadSchematic extends SubCommand {
if (plot == null) {
return sendMessage(player, C.NOT_IN_PLOT);
}
if (!(PS.get().getPlotWorld(loc.getWorld()) instanceof HybridPlotWorld)) {
if (!(loc.getPlotWorld() instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
}
HybridUtils.manager.setupRoadSchematic(plot);

View File

@ -1,11 +1,5 @@
package com.intellectualcrafters.plot.commands;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.MySQL;
@ -18,6 +12,12 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
@CommandDeclaration(
command = "database",
aliases = { "convert" },
@ -95,7 +95,7 @@ public class Database extends SubCommand {
for (final Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : map.entrySet()) {
for (final Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
final Plot plot = entry2.getValue();
if (PS.get().getPlot(plot.world, plot.id) != null) {
if (PS.get().getPlot(plot.world, plot.getId()) != null) {
MainUtil.sendMessage(player, "Skipping duplicate plot: " + plot + " | id=" + plot.temp);
continue;
}

View File

@ -96,8 +96,8 @@ public class DebugClaimTest extends SubCommand {
final ArrayList<Plot> plots = new ArrayList<>();
for (final PlotId id : MainUtil.getPlotSelectionIds(min, max)) {
final Plot plot = MainUtil.getPlotAbs(world, id);
if (PS.get().getPlot(world, plot.id) != null) {
MainUtil.sendMessage(plr, " - &cDB Already contains: " + plot.id);
if (PS.get().getPlot(world, plot.getId()) != null) {
MainUtil.sendMessage(plr, " - &cDB Already contains: " + plot.getId());
continue;
}
final Location loc = manager.getSignLoc(plotworld, plot);
@ -125,11 +125,11 @@ public class DebugClaimTest extends SubCommand {
uuid = UUIDHandler.getUUID(line, null);
}
if (uuid != null) {
MainUtil.sendMessage(plr, " - &aFound plot: " + plot.id + " : " + line);
MainUtil.sendMessage(plr, " - &aFound plot: " + plot.getId() + " : " + line);
plot.owner = uuid;
plots.add(plot);
} else {
MainUtil.sendMessage(plr, " - &cInvalid playername: " + plot.id + " : " + line);
MainUtil.sendMessage(plr, " - &cInvalid playername: " + plot.getId() + " : " + line);
}
}
}

View File

@ -20,26 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.script.SimpleScriptContext;
import com.google.common.io.Files;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@ -74,6 +54,26 @@ import com.plotsquared.bukkit.util.BukkitHybridUtils;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.script.SimpleScriptContext;
@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = { "exec" }, category = CommandCategory.DEBUG)
public class DebugExec extends SubCommand {
@ -286,7 +286,7 @@ public class DebugExec extends SubCommand {
}
MainUtil.sendMessage(player, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):");
for (final Plot plot : ExpireManager.expiredPlots.get(args[1])) {
MainUtil.sendMessage(player, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner) + " : " + ExpireManager.dates.get(plot.owner));
MainUtil.sendMessage(player, " - " + plot.world + ";" + plot.getId().x + ";" + plot.getId().y + ";" + UUIDHandler.getName(plot.owner) + " : " + ExpireManager.dates.get(plot.owner));
}
return true;
}

View File

@ -47,7 +47,7 @@ public class DebugRoadRegen extends SubCommand {
public boolean onCommand(final PlotPlayer player, final String... args) {
final Location loc = player.getLocation();
final String world = loc.getWorld();
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotWorld plotworld = loc.getPlotWorld();
if (!(plotworld instanceof HybridPlotWorld)) {
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
}
@ -66,14 +66,14 @@ public class DebugRoadRegen extends SubCommand {
}
}
final boolean result = HybridUtils.manager.regenerateRoad(world, chunk, extend);
MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result ? "&aSuccess" : "&cFailed"));
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
} else {
final HybridPlotManager manager = (HybridPlotManager) PS.get().getPlotManager(world);
manager.createRoadEast(plotworld, plot);
manager.createRoadSouth(plotworld, plot);
manager.createRoadSouthEast(plotworld, plot);
MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.id + "\n&6 - Result: &aSuccess");
MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.getId() + "\n&6 - Result: &aSuccess");
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
}
return true;

View File

@ -20,9 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.HashSet;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
@ -36,6 +33,8 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.HashSet;
@CommandDeclaration(
command = "delete",
permission = "plots.delete",
@ -60,7 +59,7 @@ public class Delete extends SubCommand {
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.delete")) {
return !sendMessage(plr, C.NO_PLOT_PERMS);
}
final PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
final PlotWorld plotworld = plot.getWorld();
final HashSet<Plot> plots = MainUtil.getConnectedPlots(plot);
final Runnable run = new Runnable() {
@Override
@ -93,7 +92,7 @@ public class Delete extends SubCommand {
}
};
if (Settings.CONFIRM_DELETE && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) {
CmdConfirm.addPending(plr, "/plot delete " + plot.id, run);
CmdConfirm.addPending(plr, "/plot delete " + plot.getId(), run);
} else {
TaskManager.runTask(run);
}

View File

@ -48,7 +48,7 @@ public class Download extends SubCommand {
}
plot.addRunning();
MainUtil.sendMessage(plr, C.GENERATING_LINK);
SchematicHandler.manager.getCompoundTag(plot.world, plot.id, new RunnableVal<CompoundTag>() {
SchematicHandler.manager.getCompoundTag(plot.world, plot.getId(), new RunnableVal<CompoundTag>() {
@Override
public void run() {
TaskManager.runTaskAsync(new Runnable() {

View File

@ -94,17 +94,20 @@ public class Info extends SubCommand {
};
final UUID uuid = player.getUUID();
final String name = MainUtil.getName(plot.owner);
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info", new String[] {
"&cID: &6" + plot.getId().toString(),
"&cOwner: &6" + name,
"&cAlias: &6" + plot.getAlias(),
"&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(),
"&cCan Build: &6" + plot.isAdded(uuid),
"&cIs Denied: &6" + plot.isDenied(uuid) }));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cTrusted", new String[] { "&cAmount: &6" + plot.getTrusted().size(), "&8Click to view a list of the trusted users" }));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cMembers", new String[] { "&cAmount: &6" + plot.getMembers().size(), "&8Click to view a list of plot members" }));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cDenied", new String[] { "&cDenied", "&cAmount: &6" + plot.getDenied().size(), "&8Click to view a list of denied players" }));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cFlags", new String[] { "&cFlags", "&cAmount: &6" + plot.getFlags().size(), "&8Click to view a list of plot flags" }));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info", "&cID: &6" + plot.getId().toString(),
"&cOwner: &6" + name,
"&cAlias: &6" + plot.getAlias(),
"&cBiome: &6" + plot.getBiome().replaceAll("_", "").toLowerCase(),
"&cCan Build: &6" + plot.isAdded(uuid),
"&cIs Denied: &6" + plot.isDenied(uuid)));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cTrusted", "&cAmount: &6" + plot.getTrusted().size(),
"&8Click to view a list of the trusted users"));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cMembers", "&cAmount: &6" + plot.getMembers().size(),
"&8Click to view a list of plot members"));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cDenied", "&cDenied", "&cAmount: &6" + plot.getDenied().size(),
"&8Click to view a list of denied players"));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cFlags", "&cFlags", "&cAmount: &6" + plot.getFlags().size(),
"&8Click to view a list of plot flags"));
inv.openInventory();
return true;
}
@ -118,7 +121,7 @@ public class Info extends SubCommand {
}
// Unclaimed?
if (!hasOwner && !containsEveryone && !trustedEveryone) {
MainUtil.sendMessage(player, C.PLOT_INFO_UNCLAIMED, (plot.id.x + ";" + plot.id.y));
MainUtil.sendMessage(player, C.PLOT_INFO_UNCLAIMED, (plot.getId().x + ";" + plot.getId().y));
return true;
}
String info = C.PLOT_INFO.s();

View File

@ -40,7 +40,7 @@ public class Kick extends SubCommand {
if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT);
}
if ((plot == null) || ((!plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.kick"))) {
if (((!plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.kick"))) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}

View File

@ -20,12 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.ConsolePlayer;
@ -43,9 +37,17 @@ import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandHandlingOutput;
import com.plotsquared.general.commands.CommandManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
/**
* PlotSquared command class
*
*
*/
public class MainCommand extends CommandManager<PlotPlayer> {
@ -325,9 +327,7 @@ public class MainCommand extends CommandManager<PlotPlayer> {
count += 5;
}
}
}
for (String word : cmd.getDescription().split(" ")) {
desc.add(word);
Collections.addAll(desc, cmd.getDescription().split(" "));
for (String arg : args) {
if (perm.startsWith(arg)) {
count++;

View File

@ -20,10 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.HashSet;
import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
@ -38,6 +34,9 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.HashSet;
import java.util.UUID;
@CommandDeclaration(
command = "merge",
aliases = { "m" },
@ -79,7 +78,7 @@ public class Merge extends SubCommand {
if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT);
}
if ((plot == null) || !plot.hasOwner()) {
if (!plot.hasOwner()) {
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false;
}
@ -93,7 +92,7 @@ public class Merge extends SubCommand {
uuid = plot.owner;
}
}
final PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
final PlotWorld plotworld = plot.getWorld();
if ((EconHandler.manager != null) && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d && EconHandler.manager.getMoney(plr) < plotworld.MERGE_PRICE) {
sendMessage(plr, C.CANNOT_AFFORD_MERGE, plotworld.MERGE_PRICE + "");
return false;
@ -164,7 +163,7 @@ public class Merge extends SubCommand {
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
return true;
}
Plot adjacent = MainUtil.getPlotAbs(plot.world, MainUtil.getPlotIdRelative(plot.id, direction));
Plot adjacent = MainUtil.getPlotAbs(plot.world, MainUtil.getPlotIdRelative(plot.getId(), direction));
if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4) || adjacent.isOwner(uuid)) {
MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE);
return false;
@ -204,7 +203,7 @@ public class Merge extends SubCommand {
}
});
}
if (isOnline == false) {
if (!isOnline) {
MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE);
return false;
}

View File

@ -83,7 +83,7 @@ public class Owner extends SetCommand {
MainUtil.setSign(name, plot);
MainUtil.sendMessage(plr, C.SET_OWNER);
if (other != null) {
MainUtil.sendMessage(other, C.NOW_OWNER, plot.world + ";" + plot.id);
MainUtil.sendMessage(other, C.NOW_OWNER, plot.world + ";" + plot.getId());
}
return true;
}

View File

@ -85,8 +85,8 @@ public class Purge extends SubCommand {
return false;
}
final String worldname = args[1];
if (!PS.get().getAllPlotsRaw().containsKey(worldname)) {
MainUtil.sendMessage(plr, "INVALID WORLD");
if (!PS.get().isPlotWorld(worldname)) {
C.NOT_VALID_PLOT_WORLD.send(plr);
return false;
}
final String arg = args[0].toLowerCase();
@ -116,7 +116,7 @@ public class Purge extends SubCommand {
if (plot.owner != null) {
final String name = UUIDHandler.getName(plot.owner);
if (name == null) {
ids.add(plot.id);
ids.add(plot.getId());
}
}
}
@ -132,7 +132,7 @@ public class Purge extends SubCommand {
final Set<PlotId> ids = new HashSet<>();
for (final Plot plot : plots) {
if (plot.owner == null) {
ids.add(plot.id);
ids.add(plot.getId());
}
}
final int length = ids.size();
@ -147,7 +147,7 @@ public class Purge extends SubCommand {
final Set<Plot> plots = PS.get().getPlots(worldname, uuid);
final Set<PlotId> ids = new HashSet<>();
for (final Plot plot : plots) {
ids.add(plot.id);
ids.add(plot.getId());
}
final int length = ids.size();
DBFunc.purge(worldname, ids);

View File

@ -54,7 +54,7 @@ public class RegenAllRoads extends SubCommand {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
return false;
}
} else {
} else if (args.length != 1) {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
return false;
}

View File

@ -50,7 +50,7 @@ public class Save extends SubCommand {
return false;
}
plot.addRunning();
SchematicHandler.manager.getCompoundTag(plot.world, plot.id, new RunnableVal<CompoundTag>() {
SchematicHandler.manager.getCompoundTag(plot.world, plot.getId(), new RunnableVal<CompoundTag>() {
@Override
public void run() {
TaskManager.runTaskAsync(new Runnable() {
@ -60,7 +60,7 @@ public class Save extends SubCommand {
final String name = PS.get().IMP.getServerName().replaceAll("[^A-Za-z0-9]", "");
Location[] corners = MainUtil.getCorners(plot);
final int size = (corners[1].getX() - corners[0].getX()) + 1;
final PlotId id = plot.id;
final PlotId id = plot.getId();
final String world = plot.world.replaceAll("[^A-Za-z0-9]", "");
final String file = time + "_" + world + "_" + id.x + "_" + id.y + "_" + size + "_" + name;
final UUID uuid = plr.getUUID();

View File

@ -20,11 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.flag.AbstractFlag;
@ -43,6 +38,10 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@CommandDeclaration(
command = "set",
description = "Set a plot value",
@ -67,10 +66,9 @@ public class Set extends SubCommand {
@Override
public boolean set(PlotPlayer plr, final Plot plot, String value) {
final String world = plr.getLocation().getWorld();
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotManager manager = PS.get().getPlotManager(world);
final String[] components = manager.getPlotComponents(plotworld, plot.id);
final PlotWorld plotworld = plr.getLocation().getPlotWorld();
final PlotManager manager = plr.getLocation().getPlotManager();
final String[] components = manager.getPlotComponents(plotworld, plot.getId());
final boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(plr.getUUID());
String[] args = value.split(" ");
@ -131,7 +129,7 @@ public class Set extends SubCommand {
}
plot.addRunning();
for (Plot current : MainUtil.getConnectedPlots(plot)) {
manager.setComponent(plotworld, current.id, component, blocks);
manager.setComponent(plotworld, current.getId(), component, blocks);
}
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
SetBlockQueue.addNotify(new Runnable() {
@ -149,11 +147,11 @@ public class Set extends SubCommand {
}
public boolean noArgs(PlotPlayer plr) {
final ArrayList<String> newValues = new ArrayList<String>();
final ArrayList<String> newValues = new ArrayList<>();
newValues.addAll(Arrays.asList("biome", "alias", "home", "flag"));
Plot plot = plr.getCurrentPlot();
if (plot != null) {
newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.getId())));
}
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan.join(newValues, C.BLOCK_LIST_SEPARATER.formatted()));
return false;
@ -175,7 +173,7 @@ public class Set extends SubCommand {
return false;
}
// components
HashSet<String> components = new HashSet<String>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
HashSet<String> components = new HashSet<>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.getId())));
if (components.contains(args[0].toLowerCase())) {
return component.onCommand(plr, Arrays.copyOfRange(args, 0, args.length));
}

View File

@ -20,11 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.ConfigurationNode;
@ -38,6 +33,11 @@ import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
@CommandDeclaration(
command = "setup",
permission = "plots.admin.command.setup",
@ -48,15 +48,15 @@ category = CommandCategory.ACTIONS)
public class Setup extends SubCommand {
public void displayGenerators(final PlotPlayer plr) {
final StringBuffer message = new StringBuffer();
final StringBuilder message = new StringBuilder();
message.append("&6What generator do you want?");
for (final Entry<String, PlotGenerator<?>> entry : SetupUtils.generators.entrySet()) {
if (entry.getKey().equals("PlotSquared")) {
message.append("\n&8 - &2" + entry.getKey() + " (Default Generator)");
message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)");
} else if (entry.getValue().isFull()) {
message.append("\n&8 - &7" + entry.getKey() + " (Plot Generator)");
message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)");
} else {
message.append("\n&8 - &7" + entry.getKey() + " (Unknown structure)");
message.append("\n&8 - &7").append(entry.getKey()).append(" (Unknown structure)");
}
}
MainUtil.sendMessage(plr, message.toString());
@ -109,8 +109,9 @@ public class Setup extends SubCommand {
break;
}
case 1: { // choose world type
final List<String> allTypes = Arrays.asList(new String[] { "default", "augmented", "partial" });
final List<String> allDesc = Arrays.asList(new String[] { "Standard plot generation", "Plot generation with vanilla terrain", "Vanilla with clusters of plots" });
final List<String> allTypes = Arrays.asList("default", "augmented", "partial");
final List<String> allDesc = Arrays.asList("Standard plot generation", "Plot generation with vanilla terrain",
"Vanilla with clusters of plots");
final ArrayList<String> types = new ArrayList<>();
if (SetupUtils.generators.get(object.setupGenerator).isFull()) {
types.add("default");
@ -170,7 +171,7 @@ public class Setup extends SubCommand {
break;
}
case 2: { // Choose terrain
final List<String> terrain = Arrays.asList(new String[] { "none", "ore", "road", "all" });
final List<String> terrain = Arrays.asList("none", "ore", "road", "all");
if ((args.length != 1) || !terrain.contains(args[0].toLowerCase())) {
MainUtil.sendMessage(plr, "&cYou must choose the terrain!"
+ "\n&8 - &2NONE&8 - &7No terrain at all"

View File

@ -58,7 +58,7 @@ public class Target extends SubCommand {
closest = plot;
}
}
id = closest.id;
id = closest.getId();
} else {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
return false;

View File

@ -20,14 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.HashSet;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.ChunkLoc;
@ -42,6 +34,15 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.HashSet;
@CommandDeclaration(
command = "trim",
permission = "plots.admin",
@ -96,7 +97,8 @@ public class Trim extends SubCommand {
PS.debug("INVALID MCA: " + name);
}
}
} catch (final Exception e) {}
} catch (IOException e) {
}
}
}
}
@ -134,8 +136,8 @@ public class Trim extends SubCommand {
}
final Plot plot = plots.remove(0);
final Location pos1 = MainUtil.getPlotBottomLocAbs(world, plot.id);
final Location pos2 = MainUtil.getPlotTopLocAbs(world, plot.id);
final Location pos1 = MainUtil.getPlotBottomLocAbs(world, plot.getId());
final Location pos2 = MainUtil.getPlotTopLocAbs(world, plot.getId());
final int ccx1 = (pos1.getX() >> 9);
final int ccz1 = (pos1.getZ() >> 9);

View File

@ -20,9 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
@ -36,6 +33,8 @@ import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.UUID;
@CommandDeclaration(
command = "trust",
aliases = { "t" },
@ -91,7 +90,7 @@ public class Trust extends SubCommand {
if (plot.removeMember(uuid)) {
plot.addTrusted(uuid);
} else {
if ((plot.getMembers().size() + plot.getTrusted().size()) >= PS.get().getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
if ((plot.getMembers().size() + plot.getTrusted().size()) >= plot.getWorld().MAX_PLOT_MEMBERS) {
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
return false;
}

View File

@ -53,6 +53,7 @@ public class Unclaim extends SubCommand {
return !sendMessage(plr, C.NO_PLOT_PERMS);
}
if (plot.unclaim()) {
plot.removeSign();
MainUtil.sendMessage(plr, C.UNCLAIM_SUCCESS);
} else {
MainUtil.sendMessage(plr, C.UNCLAIM_FAILED);

View File

@ -62,7 +62,7 @@ public class Unlink extends SubCommand {
}
};
if (Settings.CONFIRM_UNLINK && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) {
CmdConfirm.addPending(plr, "/plot unlink " + plot.id, runnable);
CmdConfirm.addPending(plr, "/plot unlink " + plot.getId(), runnable);
} else {
TaskManager.runTask(runnable);
}

View File

@ -20,14 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
@ -39,6 +31,14 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
@CommandDeclaration(
command = "visit",
permission = "plots.visit",
@ -93,7 +93,7 @@ public class Visit extends SubCommand {
} else {
final Plot plot = MainUtil.getPlotFromString(player, args[0], true);
if (plot != null) {
unsorted = new HashSet<>(Arrays.asList(plot.getBasePlot(false)));
unsorted = new HashSet<>(Collections.singletonList(plot.getBasePlot(false)));
}
}
break;

View File

@ -36,7 +36,7 @@ public class WE_Anywhere extends SubCommand {
@Override
public boolean onCommand(final PlotPlayer player, final String[] arguments) {
return MainCommand.onCommand(player, "plot", new String[] { "toggle", "worldedit" });
return MainCommand.onCommand(player, "plot", "toggle", "worldedit");
}
}

View File

@ -379,10 +379,12 @@ public class list extends SubCommand {
final PlotMessage flags = new PlotMessage().text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))).color("$1");
PlotMessage message = new PlotMessage().text("[").color("$3").text(i + "").command("/plot visit " + plot.world + ";" + plot.id).tooltip("/plot visit " + plot.world + ";" + plot.id)
PlotMessage message = new PlotMessage().text("[").color("$3").text(i + "").command("/plot visit " + plot.world + ";" + plot.getId()).tooltip("/plot visit " + plot.world + ";" + plot
.getId())
.color("$1").text("]").color("$3").text(" " + plot.toString())
.tooltip(trusted, members, flags).command("/plot info " + plot.world + ";" + plot.id)
.tooltip(trusted, members, flags).command("/plot info " + plot.world + ";" + plot.getId())
.color(color).text(" - ").color("$2");
String prefix = "";

View File

@ -32,9 +32,10 @@ public class plugin extends SubCommand {
@Override
public boolean onCommand(final PlotPlayer plr, final String[] args) {
MainUtil.sendMessage(plr, String.format("$2>> $1&lPlotSquared $2($1Version$2: $1%s$2)", StringMan.join(PS.get().IMP.getPluginVersion(), ".")));
MainUtil.sendMessage(plr, String.format("$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92"));
MainUtil.sendMessage(plr, String.format("$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki"));
MainUtil.sendMessage(plr, String.format("$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? StringMan.join(PS.get().IMP.getPluginVersion(), ".") : PS.get().update)));
MainUtil.sendMessage(plr, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92");
MainUtil.sendMessage(plr, "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki");
MainUtil.sendMessage(plr,
"$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? StringMan.join(PS.get().IMP.getPluginVersion(), ".") : PS.get().update));
return true;
}
}