diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java index 691daa93e..5fbcc9119 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java @@ -81,7 +81,8 @@ public abstract class Command { && types[2] == String[].class && types[3] == RunnableVal3.class && types[4] == RunnableVal2.class) { Command tmp = new Command(this, true) { - @Override public CompletableFuture execute(PlotPlayer player, String[] args, + @Override + public CompletableFuture execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { try { @@ -264,14 +265,13 @@ public abstract class Command { if (totalPages != 0) { // Back new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ") .color("$3").text("->").color("$3").text(Captions.CLICKABLE.getTranslated()) - .color("$2") - .send(player); + .color("$2").send(player); } } /** * @param player Caller - * @param args Arguments + * @param args Arguments * @param confirm Instance, Success, Failure * @return CompletableFuture true if the command executed fully, false in * any other case diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java index d8c41c3da..1e694f05a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java @@ -83,7 +83,7 @@ public class YamlConfiguration extends FileConfiguration { Map input; try { - input = (Map) yaml.load(contents); + input = yaml.load(contents); } catch (YAMLException e) { throw new InvalidConfigurationException(e); } catch (ClassCastException ignored) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java index 965e95644..283383df9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/json/JSONObject.java @@ -186,7 +186,7 @@ public class JSONObject { * @param object An object that has fields that should be used to make a JSONObject. * @param names An array of strings, the names of the fields to be obtained from the object. */ - public JSONObject(Object object, String names[]) { + public JSONObject(Object object, String[] names) { this(); Class c = object.getClass(); for (String name : names) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java index 48f87a96e..81e549ec8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/IPlotMain.java @@ -219,7 +219,7 @@ public interface IPlotMain extends ILogger { * Gets the generator wrapper for a world (world) and generator (name). * * @param world the world to get the generator from - * @param name the name of the generator + * @param name the name of the generator * @return the generator being used for the provided world */ GeneratorWrapper getGenerator(String world, String name); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index e2d60ce79..d371d6105 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -155,7 +155,7 @@ import java.util.zip.ZipInputStream; // // Register configuration serializable classes // -// ConfigurationSerialization.registerClass(BlockState.class, "BlockState"); + // ConfigurationSerialization.registerClass(BlockState.class, "BlockState"); ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket"); try { @@ -247,7 +247,8 @@ import java.util.zip.ZipInputStream; if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { try { if (this.IMP.initWorldEdit()) { - PlotSquared.log(Captions.PREFIX + "&6" + IMP.getPluginName() + " hooked into WorldEdit."); + PlotSquared.log(Captions.PREFIX + "&6" + IMP.getPluginName() + + " hooked into WorldEdit."); this.worldedit = WorldEdit.getInstance(); WorldEdit.getInstance().getEventBus().register(new WESubscriber()); if (Settings.Enabled_Components.COMMANDS) { @@ -284,7 +285,7 @@ import java.util.zip.ZipInputStream; } if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) { debug("`" + world + "` was not properly loaded - " + IMP.getPluginName() - + " will now try to load it properly: "); + + " will now try to load it properly: "); debug( " - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); debug( @@ -347,7 +348,8 @@ import java.util.zip.ZipInputStream; * @see IPlotMain#log(String) */ public static void log(Object message) { - if (message == null || (message instanceof Caption ? ((Caption) message).getTranslated().isEmpty() : + if (message == null || (message instanceof Caption ? + ((Caption) message).getTranslated().isEmpty() : message.toString().isEmpty())) { return; } @@ -1832,7 +1834,8 @@ import java.util.zip.ZipInputStream; if (this.version != null) { this.style.set("Version", this.version.toString()); } - this.style.set("Information", "Left Row: PlotSquared color codes ($), right row: Minecraft color codes (&)"); + this.style.set("Information", + "Left Row: PlotSquared color codes ($), right row: Minecraft color codes (&)"); Map object = new HashMap<>(16); object.put("color.1", "6"); object.put("color.2", "7"); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java index 4646a787a..8e074221d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotVersion.java @@ -37,6 +37,7 @@ public class PlotVersion { return "4." + build; } } + @Override public String toString() { if (hash == 0 && build == 0) { return "PlotSquared-NoVer-SNAPSHOT"; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java index 6c2423021..a361d7c90 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Add.java @@ -17,10 +17,8 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "add", - description = "Allow a user to build in a plot while the plot owner is online.", - usage = "/plot add ", category = CommandCategory.SETTINGS, permission = "plots.add", - requiredType = RequiredType.PLAYER) public class Add extends Command { +@CommandDeclaration(command = "add", description = "Allow a user to build in a plot while the plot owner is online.", usage = "/plot add ", category = CommandCategory.SETTINGS, permission = "plots.add", requiredType = RequiredType.PLAYER) +public class Add extends Command { public Add() { super(MainCommand.getInstance(), true); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index f569674f8..9bed571f0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -12,11 +12,10 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; -@CommandDeclaration(command = "setalias", permission = "plots.alias", - description = "Set the plot name", usage = "/plot alias ", - aliases = {"alias", "sa", "name", "rename", "setname", "seta", "nameplot"}, - category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Alias - extends SubCommand { +@CommandDeclaration(command = "setalias", permission = "plots.alias", description = "Set the plot name", usage = "/plot alias ", aliases = { + "alias", "sa", "name", "rename", "setname", "seta", + "nameplot"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) +public class Alias extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java index 2a9195028..14d6c3836 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java @@ -33,11 +33,8 @@ import java.util.ArrayList; import java.util.Objects; import java.util.Set; -@CommandDeclaration(command = "area", permission = "plots.area", - category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, - description = "Create a new PlotArea", aliases = "world", - usage = "/plot area ", confirmation = true) public class Area - extends SubCommand { +@CommandDeclaration(command = "area", permission = "plots.area", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, description = "Create a new PlotArea", aliases = "world", usage = "/plot area ", confirmation = true) +public class Area extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length == 0) { @@ -135,14 +132,14 @@ import java.util.Set; if (WorldUtil.IMP.isWorld(world)) { PlotSquared.get().loadWorld(world, null); Captions.SETUP_FINISHED.send(player); - player.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND); + player.teleport(WorldUtil.IMP.getSpawn(world), + TeleportCause.COMMAND); if (area.TERRAIN != 3) { ChunkManager.largeRegionTask(world, region, new RunnableVal() { @Override public void run(BlockVector2 value) { - AugmentedUtils - .generate(world, value.getX(), value.getZ(), - null); + AugmentedUtils.generate(world, value.getX(), + value.getZ(), null); } }, null); } @@ -258,7 +255,8 @@ import java.util.Set; String world = SetupUtils.manager.setupWorld(object); if (WorldUtil.IMP.isWorld(world)) { Captions.SETUP_FINISHED.send(player); - player.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND); + player.teleport(WorldUtil.IMP.getSpawn(world), + TeleportCause.COMMAND); } else { MainUtil.sendMessage(player, "An error occurred while creating the world: " @@ -285,13 +283,15 @@ import java.util.Set; } if (WorldUtil.IMP.isWorld(pa.worldname)) { if (!player.getLocation().getWorld().equals(pa.worldname)) { - player.teleport(WorldUtil.IMP.getSpawn(pa.worldname), TeleportCause.COMMAND); + player.teleport(WorldUtil.IMP.getSpawn(pa.worldname), + TeleportCause.COMMAND); } } else { object.terrain = 0; object.type = 0; SetupUtils.manager.setupWorld(object); - player.teleport(WorldUtil.IMP.getSpawn(pa.worldname), TeleportCause.COMMAND); + player.teleport(WorldUtil.IMP.getSpawn(pa.worldname), + TeleportCause.COMMAND); } player.setMeta("area_create_area", pa); MainUtil.sendMessage(player, @@ -432,10 +432,11 @@ import java.util.Set; "$4Stop the server and delete: " + area.worldname + "/region"); return false; } - ChunkManager - .largeRegionTask(area.worldname, area.getRegion(), new RunnableVal() { + ChunkManager.largeRegionTask(area.worldname, area.getRegion(), + new RunnableVal() { @Override public void run(BlockVector2 value) { - AugmentedUtils.generate(area.worldname, value.getX(), value.getZ(), null); + AugmentedUtils + .generate(area.worldname, value.getX(), value.getZ(), null); } }, () -> player.sendMessage("Regen complete")); return true; @@ -463,9 +464,10 @@ import java.util.Set; center = WorldUtil.IMP.getSpawn(area.worldname); } else { CuboidRegion region = area.getRegion(); - center = - new Location(area.worldname, region.getMinimumPoint().getX() + (region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) / 2, - 0, region.getMinimumPoint().getZ() + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) / 2); + center = new Location(area.worldname, region.getMinimumPoint().getX() + + (region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) / 2, + 0, region.getMinimumPoint().getZ() + + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) / 2); center.setY(1 + WorldUtil.IMP .getHighestBlock(area.worldname, center.getX(), center.getZ())); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java index c2b0fe814..75bc46039 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java @@ -23,9 +23,7 @@ import org.jetbrains.annotations.Nullable; import java.util.Set; -@CommandDeclaration(command = "auto", permission = "plots.auto", - category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, - description = "Claim the nearest plot", aliases = "a", usage = "/plot auto [length,width]") +@CommandDeclaration(command = "auto", permission = "plots.auto", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, description = "Claim the nearest plot", aliases = "a", usage = "/plot auto [length,width]") public class Auto extends SubCommand { @Deprecated public static PlotId getNextPlotId(PlotId id, int step) { @@ -177,7 +175,7 @@ public class Auto extends SubCommand { try { String[] split = args[0].split(",|;"); if (split[1] == null) { - MainUtil.sendMessage(player,"Correct use /plot auto [length,width]"); + MainUtil.sendMessage(player, "Correct use /plot auto [length,width]"); size_x = 1; size_z = 1; } else { @@ -220,12 +218,12 @@ public class Auto extends SubCommand { sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic); return true; } - if (!Permissions.hasPermission(player, - CaptionUtility.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - CaptionUtility.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility + .format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)); return true; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java index df48c1aed..0d228cc0b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Biome.java @@ -9,16 +9,17 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; -@CommandDeclaration(command = "setbiome", permission = "plots.set.biome", - description = "Set the plot biome", usage = "/plot biome [biome]", - aliases = {"biome", "sb", "setb", "b"}, category = CommandCategory.APPEARANCE, - requiredType = RequiredType.NONE) public class Biome extends SetCommand { +@CommandDeclaration(command = "setbiome", permission = "plots.set.biome", description = "Set the plot biome", usage = "/plot biome [biome]", aliases = { + "biome", "sb", "setb", + "b"}, category = CommandCategory.APPEARANCE, requiredType = RequiredType.NONE) +public class Biome extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, final String value) { BiomeType biome = null; try { biome = BiomeTypes.get(value.toLowerCase()); - } catch (final Exception ignore) {} + } catch (final Exception ignore) { + } if (biome == null) { String biomes = StringMan .join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java index f74e6ce27..6e999ab7c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Buy.java @@ -15,9 +15,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.Set; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "buy", description = "Buy the plot you are standing on", - usage = "/plot buy", permission = "plots.buy", category = CommandCategory.CLAIMING, - requiredType = RequiredType.NONE) public class Buy extends Command { +@CommandDeclaration(command = "buy", description = "Buy the plot you are standing on", usage = "/plot buy", permission = "plots.buy", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE) +public class Buy extends Command { public Buy() { super(MainCommand.getInstance(), true); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java index c2a3daf84..5cf4948c7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Chat.java @@ -3,9 +3,8 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -@CommandDeclaration(command = "chat", description = "Toggle plot chat on or off", - usage = "/plot chat [on|off]", permission = "plots.chat", category = CommandCategory.CHAT, - requiredType = RequiredType.PLAYER) public class Chat extends SubCommand { +@CommandDeclaration(command = "chat", description = "Toggle plot chat on or off", usage = "/plot chat [on|off]", permission = "plots.chat", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) +public class Chat extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { MainCommand.getInstance().toggle.chat(this, player, new String[0], null, null); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java index d54b32117..774c6610f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java @@ -17,9 +17,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.google.common.primitives.Ints; -@CommandDeclaration(command = "claim", aliases = "c", - description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING, - requiredType = RequiredType.PLAYER, permission = "plots.claim", usage = "/plot claim") +@CommandDeclaration(command = "claim", aliases = "c", description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER, permission = "plots.claim", usage = "/plot claim") public class Claim extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { @@ -38,8 +36,7 @@ public class Claim extends SubCommand { int grants = 0; if (currentPlots >= player.getAllowedPlots()) { if (player.hasPersistentMeta("grantedPlots")) { - grants = - Ints.fromByteArray(player.getPersistentMeta("grantedPlots")); + grants = Ints.fromByteArray(player.getPersistentMeta("grantedPlots")); if (grants <= 0) { player.removePersistentMeta("grantedPlots"); return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS); @@ -58,9 +55,8 @@ public class Claim extends SubCommand { return sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic); } - if (!Permissions - .hasPermission(player, CaptionUtility - .format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic); @@ -86,8 +82,7 @@ public class Claim extends SubCommand { if (grants == 1) { player.removePersistentMeta("grantedPlots"); } else { - player.setPersistentMeta("grantedPlots", - Ints.toByteArray(grants - 1)); + player.setPersistentMeta("grantedPlots", Ints.toByteArray(grants - 1)); } sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1)); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java index 07f80e414..8b40c25a9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Clear.java @@ -16,9 +16,8 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "clear", description = "Clear the plot you stand on", requiredType = RequiredType.NONE, - permission = "plots.clear", category = CommandCategory.APPEARANCE, usage = "/plot clear", - aliases = "reset", confirmation = true) public class Clear extends Command { +@CommandDeclaration(command = "clear", description = "Clear the plot you stand on", requiredType = RequiredType.NONE, permission = "plots.clear", category = CommandCategory.APPEARANCE, usage = "/plot clear", aliases = "reset", confirmation = true) +public class Clear extends Command { // Note: To clear a specific plot use /plot clear // The syntax also works with any command: /plot diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java index f1f9a401c..4958a0d89 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java @@ -22,10 +22,8 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -@CommandDeclaration(command = "cluster", aliases = "clusters", - category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, - permission = "plots.cluster", description = "Manage a plot cluster") public class Cluster - extends SubCommand { +@CommandDeclaration(command = "cluster", aliases = "clusters", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, permission = "plots.cluster", description = "Manage a plot cluster") +public class Cluster extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java index 171a5bfe5..0120063d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Comment.java @@ -16,8 +16,8 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.Arrays; import java.util.Map.Entry; -@CommandDeclaration(command = "comment", aliases = {"msg"}, description = "Comment on a plot", - category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER, permission = "plots.comment") +@CommandDeclaration(command = "comment", aliases = { + "msg"}, description = "Comment on a plot", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER, permission = "plots.comment") public class Comment extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index a9341f373..b2cee26f2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -19,10 +19,8 @@ import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -@CommandDeclaration(command = "condense", permission = "plots.admin", - usage = "/plot condense [radius]", - description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, - requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand { +@CommandDeclaration(command = "condense", permission = "plots.admin", usage = "/plot condense [radius]", description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE) +public class Condense extends SubCommand { public static boolean TASK = false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java index 75a4709b8..fa85ffb18 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Confirm.java @@ -9,9 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; -@CommandDeclaration(command = "confirm", permission = "plots.use", - description = "Confirm an action", category = CommandCategory.INFO) public class Confirm - extends SubCommand { +@CommandDeclaration(command = "confirm", permission = "plots.use", description = "Confirm an action", category = CommandCategory.INFO) +public class Confirm extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { CmdInstance command = CmdConfirm.getPending(player); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java index 2da59e2f7..63eebef04 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java @@ -9,10 +9,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; -@CommandDeclaration(command = "continue", - description = "Continue a plot that was previously marked as done", - permission = "plots.continue", category = CommandCategory.SETTINGS, - requiredType = RequiredType.PLAYER) public class Continue extends SubCommand { +@CommandDeclaration(command = "continue", description = "Continue a plot that was previously marked as done", permission = "plots.continue", category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) +public class Continue extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { Plot plot = player.getCurrentPlot(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java index de77513bc..43e0af25d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Copy.java @@ -8,9 +8,9 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; -@CommandDeclaration(command = "copy", permission = "plots.copy", aliases = {"copypaste"}, - category = CommandCategory.CLAIMING, description = "Copy a plot", usage = "/plot copy ", - requiredType = RequiredType.NONE) public class Copy extends SubCommand { +@CommandDeclaration(command = "copy", permission = "plots.copy", aliases = { + "copypaste"}, category = CommandCategory.CLAIMING, description = "Copy a plot", usage = "/plot copy ", requiredType = RequiredType.NONE) +public class Copy extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { Location location = player.getLocation(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java index 70b5952b1..efc820811 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CreateRoadSchematic.java @@ -9,11 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -@CommandDeclaration(command = "createroadschematic", aliases = {"crs"}, - category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.PLAYER, - permission = "plots.createroadschematic", - description = "Add a road schematic to your world using the roads around your current plot", - usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand { +@CommandDeclaration(command = "createroadschematic", aliases = { + "crs"}, category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.PLAYER, permission = "plots.createroadschematic", description = "Add a road schematic to your world using the roads around your current plot", usage = "/plot createroadschematic") +public class CreateRoadSchematic extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { Location location = player.getLocation(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index abbddc9ca..c5573a4cd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -22,11 +22,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; -@CommandDeclaration(command = "database", aliases = {"convert"}, - category = CommandCategory.ADMINISTRATION, permission = "plots.database", - description = "Convert/Backup Storage", requiredType = RequiredType.CONSOLE, - usage = "/plot database [area] ") public class Database - extends SubCommand { +@CommandDeclaration(command = "database", aliases = { + "convert"}, category = CommandCategory.ADMINISTRATION, permission = "plots.database", description = "Convert/Backup Storage", requiredType = RequiredType.CONSOLE, usage = "/plot database [area] ") +public class Database extends SubCommand { public static void insertPlots(final SQLManager manager, final List plots, final PlotPlayer player) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index c1970f969..7289c0601 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -9,8 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.Map; -@CommandDeclaration(command = "debug", category = CommandCategory.DEBUG, - description = "Show debug information", usage = "/plot debug [msg]", permission = "plots.admin") +@CommandDeclaration(command = "debug", category = CommandCategory.DEBUG, description = "Show debug information", usage = "/plot debug [msg]", permission = "plots.admin") public class Debug extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { @@ -19,7 +18,6 @@ public class Debug extends SubCommand { MainUtil.sendMessage(player, "Key: " + meta.getKey() + " Value: " + meta.getValue().toString() + " , "); } - ; } if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { StringBuilder msg = new StringBuilder(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java index 8413eae22..8a651cde3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugAllowUnsafe.java @@ -8,10 +8,8 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -@CommandDeclaration(command = "debugallowunsafe", - description = "Allow unsafe actions until toggled off", usage = "/plot debugallowunsafe", - category = CommandCategory.DEBUG, requiredType = RequiredType.NONE, - permission = "plots.debugallowunsafe") public class DebugAllowUnsafe extends SubCommand { +@CommandDeclaration(command = "debugallowunsafe", description = "Allow unsafe actions until toggled off", usage = "/plot debugallowunsafe", category = CommandCategory.DEBUG, requiredType = RequiredType.NONE, permission = "plots.debugallowunsafe") +public class DebugAllowUnsafe extends SubCommand { public static final List unsafeAllowed = new ArrayList<>(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java index 3c8b854e5..51630753c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java @@ -56,7 +56,8 @@ public class DebugClaimTest extends SubCommand { PlotManager manager = area.getPlotManager(); CompletableFuture.runAsync(() -> { ArrayList ids = MainUtil.getPlotSelectionIds(min, max); - MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: " + ids.size() + " plot ids to check!"); + MainUtil.sendMessage(player, + "&3Sign Block&8->&3Plot&8: " + ids.size() + " plot ids to check!"); for (PlotId id : ids) { Plot plot = area.getPlotAbs(id); if (plot.hasOwner()) { @@ -74,7 +75,8 @@ public class DebugClaimTest extends SubCommand { BiMap map = UUIDHandler.getUuidMap(); UUID uuid = map.get(new StringWrapper(line)); if (uuid == null) { - for (Map.Entry stringWrapperUUIDEntry : map.entrySet()) { + for (Map.Entry stringWrapperUUIDEntry : map + .entrySet()) { if (stringWrapperUUIDEntry.getKey().value.toLowerCase() .startsWith(line.toLowerCase())) { uuid = stringWrapperUUIDEntry.getValue(); @@ -86,11 +88,13 @@ public class DebugClaimTest extends SubCommand { uuid = UUIDHandler.getUUID(line, null); } if (uuid != null) { - MainUtil.sendMessage(player, " - &aFound plot: " + plot.getId() + " : " + line); + MainUtil.sendMessage(player, + " - &aFound plot: " + plot.getId() + " : " + line); plot.setOwner(uuid); MainUtil.sendMessage(player, " - &8Updated plot: " + plot.getId()); } else { - MainUtil.sendMessage(player, " - &cInvalid PlayerName: " + plot.getId() + " : " + line); + MainUtil.sendMessage(player, + " - &cInvalid PlayerName: " + plot.getId() + " : " + line); } } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java index 8bafa55b7..e8a59e8ff 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java @@ -55,9 +55,8 @@ import java.util.List; import java.util.UUID; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "debugexec", permission = "plots.admin", - description = "Mutli-purpose debug command", aliases = {"exec", "$"}, - category = CommandCategory.DEBUG) public class DebugExec extends SubCommand { +@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = { + "exec", "$"}, category = CommandCategory.DEBUG) public class DebugExec extends SubCommand { private ScriptEngine engine; private Bindings scope; @@ -306,8 +305,8 @@ import java.util.concurrent.CompletableFuture; System.getProperty("line.separator")); new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null, RequiredType.NONE, CommandCategory.DEBUG) { - @Override public CompletableFuture execute(PlotPlayer player, String[] args, - RunnableVal3 confirm, + @Override public CompletableFuture execute(PlotPlayer player, + String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) { try { DebugExec.this.scope.put("PlotPlayer", player); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java index ca848a6bb..64f42752f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java @@ -16,9 +16,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; -@CommandDeclaration(command = "debugfixflags", usage = "/plot debugfixflags ", - permission = "plots.debugfixflags", description = "Attempt to fix all flags for a world", - requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG) +@CommandDeclaration(command = "debugfixflags", usage = "/plot debugfixflags ", permission = "plots.debugfixflags", description = "Attempt to fix all flags for a world", requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG) public class DebugFixFlags extends SubCommand { public DebugFixFlags() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index 978c95e34..de55f81b9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -18,9 +18,8 @@ import java.io.File; import java.util.UUID; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "debugimportworlds", permission = "plots.admin", - description = "Import worlds by player name", requiredType = RequiredType.CONSOLE, - category = CommandCategory.TELEPORT) public class DebugImportWorlds extends Command { +@CommandDeclaration(command = "debugimportworlds", permission = "plots.admin", description = "Import worlds by player name", requiredType = RequiredType.CONSOLE, category = CommandCategory.TELEPORT) +public class DebugImportWorlds extends Command { public DebugImportWorlds() { super(MainCommand.getInstance(), true); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java index f12ce8d1e..bbc972438 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java @@ -5,10 +5,8 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -@CommandDeclaration(command = "debugloadtest", permission = "plots.debugloadtest", - description = "This debug command will force the reload of all plots in the DB", - usage = "/plot debugloadtest", category = CommandCategory.DEBUG, - requiredType = RequiredType.CONSOLE) public class DebugLoadTest extends SubCommand { +@CommandDeclaration(command = "debugloadtest", permission = "plots.debugloadtest", description = "This debug command will force the reload of all plots in the DB", usage = "/plot debugloadtest", category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE) +public class DebugLoadTest extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { PlotSquared.get().plots_tmp = DBFunc.getPlots(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 426b46eaa..a9351edb2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -25,9 +25,7 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", - description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste", - permission = "plots.debugpaste", category = CommandCategory.DEBUG, confirmation = true, requiredType = RequiredType.NONE) +@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste", permission = "plots.debugpaste", category = CommandCategory.DEBUG, confirmation = true, requiredType = RequiredType.NONE) public class DebugPaste extends SubCommand { private static String readFile(@NonNull final File file) throws IOException { @@ -56,7 +54,8 @@ public class DebugPaste extends SubCommand { b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';') .append(!Settings.UUID.OFFLINE).append('\n'); b.append("Plugins:"); - for (Map.Entry, Boolean> pluginInfo : PlotSquared.get().IMP.getPluginIds()) { + for (Map.Entry, Boolean> pluginInfo : PlotSquared + .get().IMP.getPluginIds()) { Map.Entry nameVersion = pluginInfo.getKey(); String name = nameVersion.getKey(); String version = nameVersion.getValue(); @@ -67,12 +66,17 @@ public class DebugPaste extends SubCommand { b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); Runtime runtime = Runtime.getRuntime(); RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); - b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n'); + b.append("Uptime: ").append( + TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes") + .append('\n'); b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n'); - b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n'); - b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n'); + b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB") + .append('\n'); + b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB") + .append('\n'); b.append("Java Name: ").append(rb.getVmName()).append('\n'); - b.append("Java Version: '").append(System.getProperty("java.version")).append("'\n"); + b.append("Java Version: '").append(System.getProperty("java.version")) + .append("'\n"); b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n"); b.append("Operating System: '").append(System.getProperty("os.name")).append("'\n"); b.append("OS Version: ").append(System.getProperty("os.version")).append('\n'); @@ -119,12 +123,13 @@ public class DebugPaste extends SubCommand { } try { - final File MultiverseWorlds = - new File(PlotSquared.get().IMP.getDirectory(), "../Multiverse-Core/worlds.yml"); - incendoPaster - .addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml", readFile(MultiverseWorlds))); + final File MultiverseWorlds = new File(PlotSquared.get().IMP.getDirectory(), + "../Multiverse-Core/worlds.yml"); + incendoPaster.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml", + readFile(MultiverseWorlds))); } catch (final IOException ignored) { - MainUtil.sendMessage(player, "&cSkipping Multiverse worlds.yml because the plugin is not in use"); + MainUtil.sendMessage(player, + "&cSkipping Multiverse worlds.yml because the plugin is not in use"); } try { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index a268f8903..391ec365f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -13,10 +13,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import java.util.Arrays; -@CommandDeclaration(command = "debugroadregen", usage = DebugRoadRegen.USAGE, - requiredType = RequiredType.NONE, - description = "Regenerate roads in the plot or region the user is, based on the road schematic", - category = CommandCategory.DEBUG, permission = "plots.debugroadregen") +@CommandDeclaration(command = "debugroadregen", usage = DebugRoadRegen.USAGE, requiredType = RequiredType.NONE, description = "Regenerate roads in the plot or region the user is, based on the road schematic", category = CommandCategory.DEBUG, permission = "plots.debugroadregen") public class DebugRoadRegen extends SubCommand { public static final String USAGE = "/plot debugroadregen "; @@ -67,13 +64,11 @@ public class DebugRoadRegen extends SubCommand { height = Integer.parseInt(args[0]); } catch (NumberFormatException ignored) { MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)"); - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - DebugRoadRegen.USAGE); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); return false; } } else if (args.length != 0) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - DebugRoadRegen.USAGE); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java index 0c544d096..2a6a0a129 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java @@ -9,10 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import java.util.ArrayList; -@CommandDeclaration(command = "debugsavetest", permission = "plots.debugsavetest", - category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE, - usage = "/plot debugsavetest", - description = "This command will force the recreation of all plots in the DB") +@CommandDeclaration(command = "debugsavetest", permission = "plots.debugsavetest", category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE, usage = "/plot debugsavetest", description = "This command will force the recreation of all plots in the DB") public class DebugSaveTest extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java index 72c6da126..fdb2bf9fc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Delete.java @@ -15,10 +15,10 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; -@CommandDeclaration(command = "delete", permission = "plots.delete", - description = "Delete the plot you stand on", usage = "/plot delete", - aliases = {"dispose", "del", "unclaim"}, category = CommandCategory.CLAIMING, - requiredType = RequiredType.NONE, confirmation = true) public class Delete extends SubCommand { +@CommandDeclaration(command = "delete", permission = "plots.delete", description = "Delete the plot you stand on", usage = "/plot delete", aliases = { + "dispose", "del", + "unclaim"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, confirmation = true) +public class Delete extends SubCommand { // Note: To delete a specific plot use /plot delete // The syntax also works with any command: /plot diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index b50e68762..c8dd62bcd 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -18,10 +18,9 @@ import com.sk89q.worldedit.world.gamemode.GameModes; import java.util.Set; import java.util.UUID; -@CommandDeclaration(command = "deny", aliases = {"d", "ban"}, - description = "Deny a user from entering a plot", usage = "/plot deny ", - category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Deny - extends SubCommand { +@CommandDeclaration(command = "deny", aliases = {"d", + "ban"}, description = "Deny a user from entering a plot", usage = "/plot deny ", category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) +public class Deny extends SubCommand { public Deny() { super(Argument.PlayerName); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java index c3e6ab38d..8e812fd6f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Desc.java @@ -7,10 +7,10 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -@CommandDeclaration(command = "setdescription", permission = "plots.set.desc", - description = "Set the plot description", usage = "/plot desc ", - aliases = {"desc", "setdesc", "setd", "description"}, category = CommandCategory.SETTINGS, - requiredType = RequiredType.PLAYER) public class Desc extends SetCommand { +@CommandDeclaration(command = "setdescription", permission = "plots.set.desc", description = "Set the plot description", usage = "/plot desc ", aliases = { + "desc", "setdesc", "setd", + "description"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) +public class Desc extends SetCommand { @Override public boolean set(PlotPlayer player, Plot plot, String desc) { if (desc.isEmpty()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java index 372231481..6366b28b4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Dislike.java @@ -3,10 +3,8 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -@CommandDeclaration(command = "dislike", permission = "plots.dislike", - description = "Dislike the plot", usage = "/plot dislike [next|purge]", - category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) public class Dislike - extends SubCommand { +@CommandDeclaration(command = "dislike", permission = "plots.dislike", description = "Dislike the plot", usage = "/plot dislike [next|purge]", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) +public class Dislike extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { return Like.handleLike(player, args, false); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java index e8446cc46..80b2d391f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Done.java @@ -14,9 +14,9 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; -@CommandDeclaration(command = "done", aliases = {"submit"}, description = "Mark a plot as done", - permission = "plots.done", category = CommandCategory.SETTINGS, - requiredType = RequiredType.NONE) public class Done extends SubCommand { +@CommandDeclaration(command = "done", aliases = { + "submit"}, description = "Mark a plot as done", permission = "plots.done", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) +public class Done extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { Location location = player.getLocation(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java index 7be230efb..e8d1a9994 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java @@ -17,10 +17,9 @@ import com.sk89q.jnbt.CompoundTag; import java.net.URL; -@CommandDeclaration(usage = "/plot download [schematic|world]", command = "download", - aliases = {"dl"}, category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, - description = "Download your plot", permission = "plots.download") public class Download - extends SubCommand { +@CommandDeclaration(usage = "/plot download [schematic|world]", command = "download", aliases = { + "dl"}, category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, description = "Download your plot", permission = "plots.download") +public class Download extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); @@ -35,8 +34,8 @@ import java.net.URL; MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } - if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot))) - && !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) { + if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot))) && !Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) { MainUtil.sendMessage(player, Captions.DONE_NOT_DONE); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index c3cc7d628..8426e9475 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -30,30 +30,29 @@ import java.util.Map; import java.util.StringJoiner; @CommandDeclaration(command = "flag", aliases = {"f", - "flag"}, usage = "/plot flag ", - description = "Set plot flags", - category = CommandCategory.SETTINGS, - requiredType = RequiredType.NONE, - permission = "plots.flag") + "flag"}, usage = "/plot flag ", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag") public class FlagCmd extends SubCommand { - private boolean checkPermValue(PlotPlayer player, PlotFlag flag, String key, String value) { + private boolean checkPermValue(PlotPlayer player, PlotFlag flag, String key, + String value) { key = key.toLowerCase(); value = value.toLowerCase(); String perm = CaptionUtility - .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), value.toLowerCase()); + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), + value.toLowerCase()); if (flag instanceof IntegerFlag && MathMan.isInteger(value)) { try { int numeric = Integer.parseInt(value); perm = perm.substring(0, perm.length() - value.length() - 1); if (numeric > 0) { - int checkRange = - PlotSquared.get().getPlatform().equalsIgnoreCase("bukkit") ? numeric : Settings.Limit.MAX_PLOTS; + int checkRange = PlotSquared.get().getPlatform().equalsIgnoreCase("bukkit") ? + numeric : + Settings.Limit.MAX_PLOTS; final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric; if (!result) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility - .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), - value.toLowerCase())); + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), value.toLowerCase())); } return result; } @@ -87,13 +86,13 @@ public class FlagCmd extends SubCommand { PlotFlag, ?> parsedFlag = listFlag.parse(value); for (final Object entry : parsedFlag.getValue()) { final String permission = CaptionUtility - .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), - entry.toString().toLowerCase()); + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), entry.toString().toLowerCase()); final boolean result = Permissions.hasPermission(player, permission); if (!result) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility - .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(), - value.toLowerCase())); + .format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), + key.toLowerCase(), value.toLowerCase())); return false; } } @@ -134,8 +133,10 @@ public class FlagCmd extends SubCommand { sendMessage(player, Captions.PLOT_NOT_CLAIMED); return false; } - if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER); + if (!plot.isOwner(player.getUUID()) && !Permissions + .hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER); return false; } PlotFlag flag = null; @@ -145,7 +146,8 @@ public class FlagCmd extends SubCommand { boolean suggested = false; try { StringComparison> stringComparison = - new StringComparison<>(args[1], GlobalFlagContainer.getInstance().getFlagMap().values()); + new StringComparison<>(args[1], + GlobalFlagContainer.getInstance().getFlagMap().values()); String best = stringComparison.getBestMatch(); if (best != null) { MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG_SUGGESTED, best); @@ -164,11 +166,13 @@ public class FlagCmd extends SubCommand { } case "set": { if (!Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG)) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG); + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG); return false; } if (args.length < 3) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag set "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot flag set "); return false; } String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " "); @@ -188,25 +192,30 @@ public class FlagCmd extends SubCommand { } case "remove": { if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_REMOVE)) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_REMOVE); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_FLAG_REMOVE); return false; } if (args.length != 2 && args.length != 3) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag remove [values]"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot flag remove [values]"); return false; } - if (!Permissions.hasPermission(player, - CaptionUtility.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[1].toLowerCase()))) { + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), + args[1].toLowerCase()))) { if (args.length != 3) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility - .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[1].toLowerCase())); + .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), + args[1].toLowerCase())); return false; } } if (args.length == 3 && flag instanceof ListFlag) { String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " "); final ListFlag listFlag = (ListFlag) flag; - final List list = plot.getFlag((Class>) listFlag.getClass()); + final List list = + plot.getFlag((Class>) listFlag.getClass()); final PlotFlag, ?> parsedFlag; try { parsedFlag = listFlag.parse(value); @@ -250,11 +259,13 @@ public class FlagCmd extends SubCommand { } case "add": if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_ADD)) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_ADD); + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_ADD); return false; } if (args.length < 3) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag add "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot flag add "); return false; } for (String entry : args[2].split(",")) { @@ -279,7 +290,8 @@ public class FlagCmd extends SubCommand { return true; case "list": if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_LIST)) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_LIST); + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_LIST); return false; } if (args.length > 1) { @@ -287,20 +299,24 @@ public class FlagCmd extends SubCommand { return false; } final Map> flags = new HashMap<>(); - for (PlotFlag plotFlag : GlobalFlagContainer.getInstance().getRecognizedPlotFlags()) { + for (PlotFlag plotFlag : GlobalFlagContainer.getInstance() + .getRecognizedPlotFlags()) { final String category = plotFlag.getFlagCategory().getTranslated(); - final Collection flagList = flags.computeIfAbsent(category, k -> new ArrayList<>()); + final Collection flagList = + flags.computeIfAbsent(category, k -> new ArrayList<>()); flagList.add(plotFlag.getName()); } - final Iterator>> iterator = flags.entrySet().iterator(); + final Iterator>> iterator = + flags.entrySet().iterator(); final StringJoiner message = new StringJoiner("\n"); while (iterator.hasNext()) { final Map.Entry> flagsEntry = iterator.next(); final List flagNames = flagsEntry.getValue(); Collections.sort(flagNames); - message.add(String.format(Captions.FLAG_LIST_ENTRY.formatted(), flagsEntry.getKey(), - StringMan.join(flagNames, ", "))); + message.add(String + .format(Captions.FLAG_LIST_ENTRY.formatted(), flagsEntry.getKey(), + StringMan.join(flagNames, ", "))); } MainUtil.sendMessage(player, message.toString()); return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCommand.java index cc52673fa..aace9d317 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCommand.java @@ -157,8 +157,7 @@ import java.util.Map; @Override public boolean onCommand(final PlotPlayer player, final String[] args) { new HelpMenu(player).setCategory(CommandCategory.SETTINGS).setCommands(this.getCommands()) - .generateMaxPages() - .generatePage(0, getParent().toString()).render(); + .generateMaxPages().generatePage(0, getParent().toString()).render(); return true; } @@ -229,8 +228,7 @@ import java.util.Map; .send(player, e.getFlag().getName(), e.getValue(), e.getErrorMessage()); return; } - boolean result = player.getLocation().getPlotAbs() - .setFlag(flag.merge(parsed.getValue())); + boolean result = player.getLocation().getPlotAbs().setFlag(flag.merge(parsed.getValue())); if (!result) { MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); return; @@ -247,18 +245,20 @@ import java.util.Map; return; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag remove [values]"); + MainUtil + .sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag remove [values]"); return; } final PlotFlag flag = getFlag(player, args[0]); if (flag == null) { return; } - if (!Permissions.hasPermission(player, - CaptionUtility.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[0].toLowerCase()))) { + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[0].toLowerCase()))) { if (args.length != 2) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility - .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), args[0].toLowerCase())); + .format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(), + args[0].toLowerCase())); return; } } @@ -266,7 +266,8 @@ import java.util.Map; if (args.length == 2 && flag instanceof ListFlag) { String value = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " "); final ListFlag listFlag = (ListFlag) flag; - final List list = plot.getFlag((Class>) listFlag.getClass()); + final List list = + plot.getFlag((Class>) listFlag.getClass()); final PlotFlag, ?> parsedFlag; try { parsedFlag = listFlag.parse(value); @@ -325,20 +326,22 @@ import java.util.Map; final Map> flags = new HashMap<>(); for (PlotFlag plotFlag : GlobalFlagContainer.getInstance().getRecognizedPlotFlags()) { final String category = plotFlag.getFlagCategory().getTranslated(); - final Collection flagList = flags.computeIfAbsent(category, k -> new ArrayList<>()); + final Collection flagList = + flags.computeIfAbsent(category, k -> new ArrayList<>()); flagList.add(plotFlag.getName()); } for (final Map.Entry> entry : flags.entrySet()) { Collections.sort(entry.getValue()); - PlotMessage plotMessage = new PlotMessage(entry.getKey() + ": ").color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()); + PlotMessage plotMessage = new PlotMessage(entry.getKey() + ": ") + .color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()); final Iterator flagIterator = entry.getValue().iterator(); while (flagIterator.hasNext()) { final String flag = flagIterator.next(); plotMessage = plotMessage.text(flag).command("/plot flag info " + flag) - .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()) - .tooltip(new PlotMessage(Captions.FLAG_LIST_SEE_INFO.getTranslated()) - .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated())); + .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()).tooltip( + new PlotMessage(Captions.FLAG_LIST_SEE_INFO.getTranslated()) + .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated())); if (flagIterator.hasNext()) { plotMessage = plotMessage.text(", ") .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java index 9a6e74d57..764bf5ae0 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Grant.java @@ -17,9 +17,8 @@ import com.google.common.primitives.Ints; import java.util.UUID; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING, - usage = "/plot grant [player]", permission = "plots.grant", - requiredType = RequiredType.NONE) public class Grant extends Command { +@CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING, usage = "/plot grant [player]", permission = "plots.grant", requiredType = RequiredType.NONE) +public class Grant extends Command { public Grant() { super(MainCommand.getInstance(), true); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java index 7949df513..b61771e15 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Help.java @@ -14,8 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.helpmenu.HelpMenu; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "help", description = "Get this help menu", aliases = "?", - category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use") +@CommandDeclaration(command = "help", description = "Get this help menu", aliases = "?", category = CommandCategory.INFO, usage = "help [category|#]", permission = "plots.use") public class Help extends Command { public Help(Command parent) { super(parent, true); @@ -56,7 +55,8 @@ public class Help extends Command { return CompletableFuture.completedFuture(true); } - public CompletableFuture displayHelp(final CommandCaller player, final String catRaw, final int page) { + public CompletableFuture displayHelp(final CommandCaller player, final String catRaw, + final int page) { return CompletableFuture.supplyAsync(() -> { String cat = catRaw; @@ -81,12 +81,11 @@ public class Help extends Command { for (CommandCategory c : CommandCategory.values()) { builder.append("\n").append(StringMan .replaceAll(Captions.HELP_INFO_ITEM.getTranslated(), "%category%", - c.toString().toLowerCase(), - "%category_desc%", c.toString())); + c.toString().toLowerCase(), "%category_desc%", c.toString())); } - builder.append("\n") - .append(Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all") - .replaceAll("%category_desc%", "Display all commands")); + builder.append("\n").append( + Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all") + .replaceAll("%category_desc%", "Display all commands")); builder.append("\n").append(Captions.HELP_FOOTER.getTranslated()); MainUtil.sendMessage(player, builder.toString(), false); return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 030ef0f44..d302cb90e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -13,8 +13,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.List; -@CommandDeclaration(command = "inbox", description = "Review the comments for a plot", - usage = "/plot inbox [inbox] [delete |clear|page]", permission = "plots.inbox", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) +@CommandDeclaration(command = "inbox", description = "Review the comments for a plot", usage = "/plot inbox [inbox] [delete |clear|page]", permission = "plots.inbox", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) public class Inbox extends SubCommand { public void displayComments(PlotPlayer player, List oldComments, int page) { @@ -40,8 +39,7 @@ public class Inbox extends SubCommand { StringBuilder string = new StringBuilder(); string.append(StringMan .replaceAll(Captions.COMMENT_LIST_HEADER_PAGED.getTranslated(), "%amount%", - comments.length, "%cur", - page + 1, "%max", totalPages + 1, "%word", "all") + '\n'); + comments.length, "%cur", page + 1, "%max", totalPages + 1, "%word", "all") + '\n'); // This might work xD for (int x = page * 12; x < max; x++) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java index 5446ee887..e45faff75 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Info.java @@ -15,8 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import java.util.UUID; -@CommandDeclaration(command = "info", aliases = "i", description = "Display plot info", - usage = "/plot info [-f, to force info]", category = CommandCategory.INFO) +@CommandDeclaration(command = "info", aliases = "i", description = "Display plot info", usage = "/plot info [-f, to force info]", category = CommandCategory.INFO) public class Info extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java index b453abeb3..64803a224 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java @@ -17,9 +17,8 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -@CommandDeclaration(command = "kick", aliases = "k", description = "Kick a player from your plot", - permission = "plots.kick", usage = "/plot kick ", category = CommandCategory.TELEPORT, - requiredType = RequiredType.PLAYER) public class Kick extends SubCommand { +@CommandDeclaration(command = "kick", aliases = "k", description = "Kick a player from your plot", permission = "plots.kick", usage = "/plot kick ", category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER) +public class Kick extends SubCommand { public Kick() { super(Argument.PlayerName); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java index 187977b2b..ed3652944 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Leave.java @@ -13,10 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import java.util.UUID; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "leave", - description = "Removes self from being trusted or a member of the plot", - permission = "plots.leave", usage = "/plot leave", category = CommandCategory.CLAIMING, - requiredType = RequiredType.PLAYER) public class Leave extends Command { +@CommandDeclaration(command = "leave", description = "Removes self from being trusted or a member of the plot", permission = "plots.leave", usage = "/plot leave", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER) +public class Leave extends Command { public Leave() { super(MainCommand.getInstance(), true); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java index 191ca458f..4e1ae61d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Like.java @@ -21,9 +21,8 @@ import java.util.HashMap; import java.util.List; import java.util.UUID; -@CommandDeclaration(command = "like", permission = "plots.like", description = "Like the plot", - usage = "/plot like [next|purge]", category = CommandCategory.INFO, - requiredType = RequiredType.PLAYER) public class Like extends SubCommand { +@CommandDeclaration(command = "like", permission = "plots.like", description = "Like the plot", usage = "/plot like [next|purge]", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) +public class Like extends SubCommand { protected static boolean handleLike(final PlotPlayer player, String[] args, final boolean like) { @@ -41,8 +40,8 @@ import java.util.UUID; return v2 > v1 ? 1 : -1; }); for (final Plot plot : plots) { - if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(plot)) - && plot.isBasePlot() && (!plot.getLikes().containsKey(uuid))) { + if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(plot)) && plot + .isBasePlot() && (!plot.getLikes().containsKey(uuid))) { plot.teleportPlayer(player, TeleportCause.COMMAND); MainUtil.sendMessage(player, Captions.RATE_THIS); return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java index 1605fc397..a04a7c4a2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java @@ -28,9 +28,8 @@ import java.util.List; import java.util.Map.Entry; import java.util.UUID; -@CommandDeclaration(command = "list", aliases = {"l", "find", "search"}, description = "List plots", - permission = "plots.list", category = CommandCategory.INFO, - usage = "/plot list > [#]") +@CommandDeclaration(command = "list", aliases = {"l", "find", + "search"}, description = "List plots", permission = "plots.list", category = CommandCategory.INFO, usage = "/plot list > [#]") public class ListCmd extends SubCommand { private String[] getArgumentList(PlotPlayer player) { @@ -137,11 +136,10 @@ public class ListCmd extends SubCommand { Captions.PERMISSION_LIST_WORLD); return false; } - if (!Permissions - .hasPermission(player, - CaptionUtility.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - CaptionUtility.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world)); + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world)); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots(world)); @@ -162,11 +160,10 @@ public class ListCmd extends SubCommand { .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_AREA); return false; } - if (!Permissions - .hasPermission(player, - CaptionUtility.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - CaptionUtility.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world)); + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world)); return false; } plots = area == null ? new ArrayList() : new ArrayList<>(area.getPlots()); @@ -308,9 +305,8 @@ public class ListCmd extends SubCommand { Captions.PERMISSION_LIST_WORLD); return false; } - if (!Permissions - .hasPermission(player, CaptionUtility - .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]))) { + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility .format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0])); return false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java index 4b0305969..87b7d28b6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java @@ -19,9 +19,8 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.List; -@CommandDeclaration(command = "load", aliases = "restore", category = CommandCategory.SCHEMATIC, - requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load", - usage = "/plot load") public class Load extends SubCommand { +@CommandDeclaration(command = "load", aliases = "restore", category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, description = "Load your plot", permission = "plots.load", usage = "/plot load") +public class Load extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java index 696c0752e..c754ed78a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java @@ -23,9 +23,8 @@ import java.util.concurrent.CompletableFuture; /** * PlotSquared command class. */ -@CommandDeclaration(command = "plot", - aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"}) -public class MainCommand extends Command { +@CommandDeclaration(command = "plot", aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", + "2", "plotme", "plotz", "ap"}) public class MainCommand extends Command { private static MainCommand instance; public Help help; @@ -208,7 +207,8 @@ public class MainCommand extends Command { PlotArea area = player.getApplicablePlotArea(); Plot newPlot = Plot.fromString(area, args[0]); if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea() - .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_SUDO_AREA)) + .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN) + || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_SUDO_AREA)) && !newPlot.isDenied(player.getUUID())) { Location newLoc = newPlot.getCenter(); if (player.canTeleport(newLoc)) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java index 43204b266..735ffc274 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Merge.java @@ -20,10 +20,7 @@ import java.util.UUID; import static com.github.intellectualsites.plotsquared.plot.object.Direction.getFromIndex; -@CommandDeclaration(command = "merge", aliases = "m", - description = "Merge the plot you are standing on with another plot", - permission = "plots.merge", usage = "/plot merge [removeroads]", - category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, confirmation = true) +@CommandDeclaration(command = "merge", aliases = "m", description = "Merge the plot you are standing on with another plot", permission = "plots.merge", usage = "/plot merge [removeroads]", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, confirmation = true) public class Merge extends SubCommand { public static final String[] values = new String[] {"north", "east", "south", "west", "auto"}; @@ -160,8 +157,7 @@ public class Merge extends SubCommand { } Plot adjacent = plot.getRelative(direction); if (adjacent == null || !adjacent.hasOwner() || adjacent - .getMerged((direction.getIndex() + 2) % 4) - || adjacent.isOwner(uuid)) { + .getMerged((direction.getIndex() + 2) % 4) || adjacent.isOwner(uuid)) { MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java index 95e07f9cd..d4484881b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Middle.java @@ -10,10 +10,9 @@ import com.github.intellectualsites.plotsquared.plot.object.TeleportCause; /** * @author manuelgu, altered by Citymonstret */ -@CommandDeclaration(command = "middle", aliases = {"center", "centre"}, - description = "Teleports you to the center of the plot", usage = "/plot middle", - category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER) public class Middle - extends SubCommand { +@CommandDeclaration(command = "middle", aliases = {"center", + "centre"}, description = "Teleports you to the center of the plot", usage = "/plot middle", category = CommandCategory.TELEPORT, requiredType = RequiredType.PLAYER) +public class Middle extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] arguments) { Location location = player.getLocation(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 02c7494cb..20ce8d4a5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -10,9 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; -@CommandDeclaration(usage = "/plot move ", command = "move", description = "Move a plot", - permission = "plots.move", category = CommandCategory.CLAIMING, - requiredType = RequiredType.PLAYER) public class Move extends SubCommand { +@CommandDeclaration(usage = "/plot move ", command = "move", description = "Move a plot", permission = "plots.move", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER) +public class Move extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { Location location = player.getLocation(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java index a1ad2d472..4332ec05e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Music.java @@ -13,10 +13,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.Locale; -@CommandDeclaration(command = "music", permission = "plots.music", - description = "Play music in your plot", usage = "/plot music", - category = CommandCategory.APPEARANCE, requiredType = RequiredType.PLAYER) public class Music - extends SubCommand { +@CommandDeclaration(command = "music", permission = "plots.music", description = "Play music in your plot", usage = "/plot music", category = CommandCategory.APPEARANCE, requiredType = RequiredType.PLAYER) +public class Music extends SubCommand { private static final Collection DISCS = Arrays .asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp", diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java index d897fb3cf..8cc18b38b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Near.java @@ -11,8 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players", - usage = "/plot near", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) +@CommandDeclaration(command = "near", aliases = "n", description = "Display nearby players", usage = "/plot near", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) public class Near extends Command { public Near() { super(MainCommand.getInstance(), true); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 82ec9f652..e823485ae 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -14,10 +14,10 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import java.util.Set; import java.util.UUID; -@CommandDeclaration(command = "setowner", permission = "plots.set.owner", - description = "Set the plot owner", usage = "/plot setowner ", - aliases = {"owner", "so", "seto"}, category = CommandCategory.CLAIMING, - requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand { +@CommandDeclaration(command = "setowner", permission = "plots.set.owner", description = "Set the plot owner", usage = "/plot setowner ", aliases = { + "owner", "so", + "seto"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, confirmation = true) +public class Owner extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, String value) { if (value == null || value.isEmpty()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index 8e31051fb..35c9fae40 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -8,9 +8,8 @@ import com.github.intellectualsites.plotsquared.plot.util.HttpUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; -@CommandDeclaration(command = "plugin", permission = "plots.use", - description = "Show plugin information", usage = "/plot plugin", aliases = "version", - category = CommandCategory.INFO) public class PluginCmd extends SubCommand { +@CommandDeclaration(command = "plugin", permission = "plots.use", description = "Show plugin information", usage = "/plot plugin", aliases = "version", category = CommandCategory.INFO) +public class PluginCmd extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { TaskManager.IMP.taskAsync(new Runnable() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java index 0825b9610..fb0625a03 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java @@ -18,11 +18,8 @@ import java.util.HashSet; import java.util.Map.Entry; import java.util.UUID; -@CommandDeclaration( - usage = "/plot purge world: area: id: owner: shared: unknown:[true|false]", - command = "purge", permission = "plots.admin", description = "Purge all plots for a world", - category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, - confirmation = true) public class Purge extends SubCommand { +@CommandDeclaration(usage = "/plot purge world: area: id: owner: shared: unknown:[true|false]", command = "purge", permission = "plots.admin", description = "Purge all plots for a world", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, confirmation = true) +public class Purge extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length == 0) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java index 453b548ed..a2de17560 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java @@ -24,9 +24,8 @@ import java.util.HashMap; import java.util.Map.Entry; import java.util.UUID; -@CommandDeclaration(command = "rate", permission = "plots.rate", description = "Rate the plot", - usage = "/plot rate [#|next|purge]", aliases = "rt", category = CommandCategory.INFO, - requiredType = RequiredType.PLAYER) public class Rate extends SubCommand { +@CommandDeclaration(command = "rate", permission = "plots.rate", description = "Rate the plot", usage = "/plot rate [#|next|purge]", aliases = "rt", category = CommandCategory.INFO, requiredType = RequiredType.PLAYER) +public class Rate extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length == 1) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java index e47cb610f..858635840 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java @@ -10,11 +10,9 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotManager; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -@CommandDeclaration(command = "regenallroads", - description = "Regenerate all roads in the map using the set road schematic", - aliases = {"rgar"}, usage = "/plot regenallroads [height]", - category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, - permission = "plots.regenallroads") public class RegenAllRoads extends SubCommand { +@CommandDeclaration(command = "regenallroads", description = "Regenerate all roads in the map using the set road schematic", aliases = { + "rgar"}, usage = "/plot regenallroads [height]", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, permission = "plots.regenallroads") +public class RegenAllRoads extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { int height = 0; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java index cc5c8c21a..471d7385d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Relight.java @@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import java.util.concurrent.CompletableFuture; -@CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight", - category = CommandCategory.DEBUG, requiredType = RequiredType.PLAYER) public class Relight extends Command { +@CommandDeclaration(command = "relight", description = "Relight your plot", usage = "/plot relight", category = CommandCategory.DEBUG, requiredType = RequiredType.PLAYER) +public class Relight extends Command { public Relight() { super(MainCommand.getInstance(), true); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java index db900e91e..433f153c8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java @@ -12,9 +12,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import java.io.IOException; import java.util.Objects; -@CommandDeclaration(command = "reload", aliases = "rl", permission = "plots.admin.command.reload", - description = "Reload translations and world settings", usage = "/plot reload", - category = CommandCategory.ADMINISTRATION) public class Reload extends SubCommand { +@CommandDeclaration(command = "reload", aliases = "rl", permission = "plots.admin.command.reload", description = "Reload translations and world settings", usage = "/plot reload", category = CommandCategory.ADMINISTRATION) +public class Reload extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { try { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java index debf93c28..5c836ecc8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Remove.java @@ -17,10 +17,9 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -@CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"}, - description = "Remove a player from a plot", usage = "/plot remove ", - category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, - permission = "plots.remove") public class Remove extends SubCommand { +@CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban", + "ud"}, description = "Remove a player from a plot", usage = "/plot remove ", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.remove") +public class Remove extends SubCommand { public Remove() { super(Argument.PlayerName); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java index d000f55e2..762b9ffec 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java @@ -18,9 +18,9 @@ import java.net.URL; import java.util.List; import java.util.UUID; -@CommandDeclaration(command = "save", aliases = {"backup"}, description = "Save your plot", - category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, - permission = "plots.save") public class Save extends SubCommand { +@CommandDeclaration(command = "save", aliases = { + "backup"}, description = "Save your plot", category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, permission = "plots.save") +public class Save extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index 130f2ad1d..35880f256 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -23,9 +23,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.UUID; -@CommandDeclaration(command = "schematic", permission = "plots.schematic", - description = "Schematic command", aliases = {"sch", "schem"}, - category = CommandCategory.SCHEMATIC, usage = "/plot schematic ") +@CommandDeclaration(command = "schematic", permission = "plots.schematic", description = "Schematic command", aliases = { + "sch", + "schem"}, category = CommandCategory.SCHEMATIC, usage = "/plot schematic ") public class SchematicCmd extends SubCommand { private boolean running = false; @@ -136,7 +136,8 @@ public class SchematicCmd extends SubCommand { return false; } else { MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED); - MainUtil.sendMessage(player, "&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); + MainUtil.sendMessage(player, + "&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); } break; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java index e91aa5207..2d17cf57e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Set.java @@ -22,10 +22,9 @@ import java.util.HashSet; import java.util.stream.Collectors; import java.util.stream.IntStream; -@CommandDeclaration(command = "set", description = "Set a plot value", aliases = {"s"}, - usage = "/plot set ", permission = "plots.set", - category = CommandCategory.APPEARANCE, requiredType = RequiredType.NONE) public class Set - extends SubCommand { +@CommandDeclaration(command = "set", description = "Set a plot value", aliases = { + "s"}, usage = "/plot set ", permission = "plots.set", category = CommandCategory.APPEARANCE, requiredType = RequiredType.NONE) +public class Set extends SubCommand { public static final String[] values = new String[] {"biome", "alias", "home", "flag"}; public static final String[] aliases = new String[] {"b", "w", "wf", "f", "a", "h", "fl"}; @@ -51,7 +50,8 @@ import java.util.stream.IntStream; for (String component : components) { if (component.equalsIgnoreCase(args[0])) { if (!Permissions.hasPermission(player, CaptionUtility - .format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), component))) { + .format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), + component))) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility .format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), component)); @@ -86,12 +86,11 @@ import java.util.stream.IntStream; new ArrayList<>(Arrays.asList("biome", "alias", "home", "flag")); Plot plot = player.getCurrentPlot(); if (plot != null) { - newValues.addAll( - Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); + newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); } - MainUtil - .sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan - .join(newValues, Captions.BLOCK_LIST_SEPARATOR.formatted())); + MainUtil.sendMessage(player, + Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan + .join(newValues, Captions.BLOCK_LIST_SEPARATOR.formatted())); return false; } @@ -114,8 +113,8 @@ import java.util.stream.IntStream; return false; } // components - HashSet components = new HashSet<>( - Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); + HashSet components = + new HashSet<>(Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); if (components.contains(args[0].toLowerCase())) { return this.component.onCommand(player, Arrays.copyOfRange(args, 0, args.length)); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java index 8c2c0740a..b209ac9af 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetCommand.java @@ -18,21 +18,19 @@ public abstract class SetCommand extends SubCommand { return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - if (!Permissions - .hasPermission(player, - CaptionUtility.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - CaptionUtility.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId())); + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility + .format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId())); MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED); return false; } } if (!plot.isOwner(player.getUUID())) { - if (!Permissions - .hasPermission(player, - CaptionUtility.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) { - MainUtil.sendMessage(player, Captions.NO_PERMISSION, - CaptionUtility.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId())); + if (!Permissions.hasPermission(player, CaptionUtility + .format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility + .format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId())); MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java index 4b742ad94..2c6e04bfb 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SetHome.java @@ -8,9 +8,8 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -@CommandDeclaration(command = "sethome", permission = "plots.set.home", - description = "Set the plot home to your current position", usage = "/plot sethome [none]", - aliases = {"sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) +@CommandDeclaration(command = "sethome", permission = "plots.set.home", description = "Set the plot home to your current position", usage = "/plot sethome [none]", aliases = { + "sh", "seth"}, category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class SetHome extends SetCommand { @Override public boolean set(PlotPlayer player, Plot plot, String value) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java index 8b8b22653..4ee450098 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java @@ -34,9 +34,14 @@ import java.util.Map; import java.util.Map.Entry; import java.util.UUID; -@CommandDeclaration(command = "setup", permission = "plots.admin.command.setup", - description = "Setup wizard for plot worlds", usage = "/plot setup", aliases = {"create"}, - category = CommandCategory.ADMINISTRATION) public class Setup extends SubCommand { +@CommandDeclaration(command = "setup", permission = "plots.admin.command.setup", description = "Setup wizard for plot worlds", usage = "/plot setup", aliases = { + "create"}, category = CommandCategory.ADMINISTRATION) public class Setup extends SubCommand { + + private static boolean d(String s) { + return s.chars().allMatch((i) -> { + return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; + }); + } public void displayGenerators(PlotPlayer player) { StringBuilder message = new StringBuilder(); @@ -336,11 +341,7 @@ import java.util.UUID; return false; } - private static boolean d(String s) { - return s.chars().allMatch((i) -> { - return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; - }); - } + private static final class StepPickGenerator extends SetupStep { @Getter private String generator; @@ -414,7 +415,7 @@ import java.util.UUID; } @Override public boolean parseInput(String input) { - if (!WORLD_TYPES.keySet().contains(input.toLowerCase())) { + if (!WORLD_TYPES.containsKey(input.toLowerCase())) { return false; } this.worldType = input.toLowerCase(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java index b3ec2ff05..71c38f887 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Swap.java @@ -8,8 +8,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; -@CommandDeclaration(usage = "/plot swap ", command = "swap", description = "Swap two plots", - aliases = {"switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER) +@CommandDeclaration(usage = "/plot swap ", command = "swap", description = "Swap two plots", aliases = { + "switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER) public class Swap extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java index 4dd37bdb0..5c1203e3d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java @@ -10,10 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.StringMan; -@CommandDeclaration(command = "target", usage = "/plot target <|nearest>", - description = "Target a plot with your compass", permission = "plots.target", - requiredType = RequiredType.PLAYER, category = CommandCategory.INFO) public class Target - extends SubCommand { +@CommandDeclaration(command = "target", usage = "/plot target <|nearest>", description = "Target a plot with your compass", permission = "plots.target", requiredType = RequiredType.PLAYER, category = CommandCategory.INFO) +public class Target extends SubCommand { public Target() { super(Argument.PlotID); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java index d001388ea..912cebeee 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java @@ -29,10 +29,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; -@CommandDeclaration(command = "template", permission = "plots.admin", - description = "Create or use a world template", - usage = "/plot template [import|export]