From 6f90700187360cd153abbf8f85f5226a272d0c3c Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 31 Jul 2015 19:46:07 +1000 Subject: [PATCH] Plot info footer --- pom.xml | 2 +- .../com/intellectualcrafters/plot/commands/Info.java | 1 + .../intellectualcrafters/plot/commands/Update.java | 2 +- .../com/intellectualcrafters/plot/commands/Visit.java | 6 ------ .../com/intellectualcrafters/plot/commands/list.java | 6 ++++++ .../intellectualcrafters/plot/commands/plugin.java | 5 +++-- .../java/com/intellectualcrafters/plot/config/C.java | 1 + .../intellectualcrafters/plot/object/PlotWorld.java | 5 +++++ .../com/intellectualcrafters/plot/util/MainUtil.java | 4 ++++ .../com/plotsquared/bukkit/uuid/FileUUIDHandler.java | 11 ++++++++--- 10 files changed, 30 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index d2e786532..d2267de9f 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 3.0.1 + 3.0.4 PlotSquared jar diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/src/main/java/com/intellectualcrafters/plot/commands/Info.java index 305c8d941..198bdc917 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -265,6 +265,7 @@ public class Info extends SubCommand { } MainUtil.sendMessage(player, C.PLOT_INFO_HEADER); MainUtil.sendMessage(player, info, false); + MainUtil.sendMessage(player, C.PLOT_INFO_FOOTER); } }); return; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Update.java b/src/main/java/com/intellectualcrafters/plot/commands/Update.java index 7fa7ccbc1..426211bb0 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Update.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Update.java @@ -34,7 +34,7 @@ import com.plotsquared.general.commands.CommandDeclaration; permission = "plots.admin", description = "Update PlotSquared", usage = "/plot update", - requiredType = RequiredType.CONSOLE, + requiredType = RequiredType.PLAYER, aliases = {"updateplugin"}, category = CommandCategory.DEBUG ) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index a039c9936..c243f92f1 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -45,12 +45,6 @@ import com.plotsquared.general.commands.CommandDeclaration; ) public class Visit extends SubCommand { - public Visit() { - requiredArguments = new Argument[] { - Argument.String - }; - } - public List getPlots(final UUID uuid) { final List plots = new ArrayList<>(); for (final Plot p : PS.get().getPlots()) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/list.java b/src/main/java/com/intellectualcrafters/plot/commands/list.java index 9b0b58cf8..790e08d71 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -271,6 +271,12 @@ public class list extends SubCommand { break; } UUID uuid = UUIDHandler.getUUID(args[0], null); + if (uuid == null) { + try { + uuid = UUID.fromString(args[0]); + } + catch (Exception e) {} + } if (uuid != null) { if (!Permissions.hasPermission(plr, "plots.list.player")) { MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.player"); diff --git a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java index 5c3e71a14..3b14756d0 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java @@ -28,6 +28,7 @@ import java.util.ArrayList; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.TaskManager; import com.plotsquared.general.commands.CommandDeclaration; @@ -35,7 +36,7 @@ import com.plotsquared.general.commands.CommandDeclaration; command = "plugin", permission = "plots.use", description = "Show plugin information", - aliases = {"version}"}, + aliases = {"version"}, category = CommandCategory.INFO ) public class plugin extends SubCommand { @@ -80,7 +81,7 @@ public class plugin extends SubCommand { } }; for (final String s : strings) { - plr.sendMessage(s); + MainUtil.sendMessage(plr, s); } } }); diff --git a/src/main/java/com/intellectualcrafters/plot/config/C.java b/src/main/java/com/intellectualcrafters/plot/config/C.java index ddfcf754e..3f11e69fc 100644 --- a/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -386,6 +386,7 @@ public enum C { PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"), PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner: $2%owner%$1&-" + "$1Biome: $2%biome%$1&-" + "$1Can Build: $2%build%$1&-" + "$1Rating: $2%rating%&-" + "$1Trusted: $2%trusted%$1&-" + "$1Members: $2%members%$1&-" + "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"), + PLOT_INFO_FOOTER("$3&m---------&r $1INFO $3&m---------", false, "Info"), PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), PLOT_INFO_MEMBERS("$1Members:$2 %members%", "Info"), PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"), diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java b/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java index 4201c021f..d3c9958ef 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java +++ b/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java @@ -160,19 +160,24 @@ public abstract class PlotWorld { case "s": case "0": this.GAMEMODE = PlotGamemode.SURVIVAL; + break; case "creative": case "c": case "1": this.GAMEMODE = PlotGamemode.CREATIVE; + break; case "adventure": case "a": case "2": this.GAMEMODE = PlotGamemode.ADVENTURE; + break; case "spectator": case "3": this.GAMEMODE = PlotGamemode.SPECTATOR; + break; default: PS.debug("&cInvalid gamemode set for: " + worldname); + break; } this.HOME_ALLOW_NONMEMBER = config.getBoolean("home.allow-nonmembers"); diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index f66af5317..0781d8a08 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -1370,12 +1370,16 @@ public class MainUtil { final com.intellectualcrafters.plot.object.Location bot2 = MainUtil.getPlotBottomLoc(plot2.world, plot2.id); final Location top = MainUtil.getPlotTopLoc(plot1.world, plot1.id); if (plot1.owner == null) { + PS.debug(plot2 +" is unowned (single)"); + TaskManager.runTask(whenDone); return false; } final Plot pos1 = getBottomPlot(plot1); final Plot pos2 = getTopPlot(plot1); final PlotId size = MainUtil.getSize(plot1); if (!MainUtil.isUnowned(plot2.world, plot2.id, new PlotId((plot2.id.x + size.x) - 1, (plot2.id.y + size.y) - 1))) { + PS.debug(plot2 +" is unowned (multi)"); + TaskManager.runTask(whenDone); return false; } final int offset_x = plot2.id.x - pos1.id.x; diff --git a/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java b/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java index 083afb9c9..cca9e507d 100644 --- a/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -74,7 +74,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { final String s = current.replaceAll(".dat$", ""); try { UUID uuid = UUID.fromString(s); - if (check || all.contains(uuid)) { + if (check || all.remove(uuid)) { File file = new File(playerdataFolder + File.separator + current); InputSupplier is = Files.newInputStreamSupplier(file); NbtFactory.NbtCompound compound = NbtFactory.fromStream(is, NbtFactory.StreamOptions.GZIP_COMPRESSION); @@ -91,8 +91,13 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } } add(toAdd); - if (whenDone != null) whenDone.run(); - return; + if (all.size() == 0) { + if (whenDone != null) whenDone.run(); + return; + } + else { + PS.debug("Failed to cache: " + all.size() + " uuids - slowly processing all files"); + } } final HashSet worlds = new HashSet<>(); worlds.add(world);