From 25530ed7f0af64bd729de84818600a890394ac0e Mon Sep 17 00:00:00 2001 From: matt <4009945+MattBDev@users.noreply.github.com> Date: Fri, 22 Feb 2019 11:51:06 -0500 Subject: [PATCH] Doc Updates, Renaming, Reformatting, and a Test Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com> --- .../plotsquared/bukkit/BukkitMain.java | 120 +++---- .../bukkit/commands/DebugUUID.java | 12 +- .../bukkit/listeners/ChunkListener.java | 20 +- .../bukkit/listeners/ForceFieldListener.java | 8 +- .../bukkit/listeners/PlayerEvents.java | 297 ++++++++++-------- .../bukkit/object/BukkitPlayer.java | 8 +- .../bukkit/object/schematic/StateWrapper.java | 4 +- .../bukkit/util/BukkitChatManager.java | 4 +- .../plotsquared/bukkit/util/BukkitUtil.java | 6 +- .../bukkit/uuid/FileUUIDHandler.java | 12 +- .../bukkit/uuid/SQLUUIDHandler.java | 47 +-- .../plotsquared/api/PlotAPI.java | 20 +- .../plotsquared/commands/Command.java | 38 +-- .../plotsquared/plot/PlotSquared.java | 130 ++++---- .../plotsquared/plot/commands/Add.java | 28 +- .../plotsquared/plot/commands/Alias.java | 42 +-- .../plotsquared/plot/commands/Area.java | 69 ++-- .../plotsquared/plot/commands/Auto.java | 37 +-- .../plotsquared/plot/commands/Biome.java | 12 +- .../plotsquared/plot/commands/Buy.java | 24 +- .../plotsquared/plot/commands/Claim.java | 33 +- .../plotsquared/plot/commands/Clear.java | 17 +- .../plotsquared/plot/commands/Cluster.java | 278 ++++++++-------- .../plotsquared/plot/commands/Comment.java | 18 +- .../plotsquared/plot/commands/Confirm.java | 6 +- .../plotsquared/plot/commands/Continue.java | 17 +- .../plotsquared/plot/commands/Copy.java | 20 +- .../plot/commands/CreateRoadSchematic.java | 6 +- .../plotsquared/plot/commands/Debug.java | 12 +- .../plot/commands/DebugAllowUnsafe.java | 6 +- .../plot/commands/DebugClaimTest.java | 4 +- .../plotsquared/plot/commands/DebugExec.java | 28 +- .../plot/commands/DebugFixFlags.java | 4 +- .../plotsquared/plot/commands/DebugPaste.java | 5 +- .../plot/commands/DebugRoadRegen.java | 8 +- .../plot/commands/DebugSaveTest.java | 10 +- .../plotsquared/plot/commands/Delete.java | 18 +- .../plotsquared/plot/commands/Deny.java | 28 +- .../plotsquared/plot/commands/Desc.java | 8 +- .../plotsquared/plot/commands/Done.java | 18 +- .../plotsquared/plot/commands/Download.java | 32 +- .../plotsquared/plot/commands/FlagCmd.java | 116 +++---- .../plot/commands/GenerateDocs.java | 8 +- .../plotsquared/plot/commands/Grant.java | 14 +- .../plotsquared/plot/commands/Help.java | 13 +- .../plotsquared/plot/commands/Inbox.java | 44 +-- .../plotsquared/plot/commands/Info.java | 35 ++- .../plotsquared/plot/commands/Kick.java | 24 +- .../plotsquared/plot/commands/Leave.java | 16 +- .../plotsquared/plot/commands/ListCmd.java | 140 +++++---- .../plotsquared/plot/commands/Load.java | 36 +-- .../plot/commands/MainCommand.java | 13 +- .../plotsquared/plot/commands/Merge.java | 63 ++-- .../plotsquared/plot/commands/Middle.java | 6 +- .../plotsquared/plot/commands/Move.java | 22 +- .../plotsquared/plot/commands/Music.java | 12 +- .../plotsquared/plot/commands/Near.java | 6 +- .../plotsquared/plot/commands/Owner.java | 27 +- .../plotsquared/plot/commands/Purge.java | 18 +- .../plotsquared/plot/commands/Rate.java | 40 +-- .../plot/commands/RegenAllRoads.java | 15 +- .../plotsquared/plot/commands/Relight.java | 6 +- .../plotsquared/plot/commands/Reload.java | 8 +- .../plotsquared/plot/commands/Remove.java | 14 +- .../plotsquared/plot/commands/Save.java | 18 +- .../plot/commands/SchematicCmd.java | 65 ++-- .../plotsquared/plot/commands/Set.java | 30 +- .../plotsquared/plot/commands/SetCommand.java | 22 +- .../plotsquared/plot/commands/SetHome.java | 8 +- .../plotsquared/plot/commands/Setup.java | 32 +- .../plotsquared/plot/commands/SubCommand.java | 4 +- .../plotsquared/plot/commands/Swap.java | 20 +- .../plotsquared/plot/commands/Target.java | 8 +- .../plotsquared/plot/commands/Template.java | 20 +- .../plotsquared/plot/commands/Toggle.java | 22 +- .../plotsquared/plot/commands/Trim.java | 8 +- .../plotsquared/plot/commands/Trust.java | 28 +- .../plotsquared/plot/commands/Unlink.java | 16 +- .../plotsquared/plot/commands/Visit.java | 34 +- .../plot/config/{C.java => Captions.java} | 22 +- .../plot/generator/HybridPlotWorld.java | 4 +- .../plot/generator/HybridUtils.java | 4 +- .../plot/listener/PlotListener.java | 29 +- .../plot/listener/ProcessedWEExtent.java | 7 +- .../plot/listener/WESubscriber.java | 4 +- .../plotsquared/plot/object/BlockBucket.java | 4 +- .../plotsquared/plot/object/Plot.java | 31 +- .../plotsquared/plot/object/PlotMessage.java | 4 +- .../plotsquared/plot/object/PlotPlayer.java | 14 +- .../plot/object/chat/PlainChatManager.java | 4 +- .../plot/object/worlds/SinglePlot.java | 4 +- .../plotsquared/plot/util/CmdConfirm.java | 4 +- .../plotsquared/plot/util/CommentManager.java | 4 +- .../plotsquared/plot/util/EventUtil.java | 166 ++++++---- .../plot/util/LegacyConverter.java | 8 +- .../plotsquared/plot/util/MainUtil.java | 52 +-- .../plotsquared/plot/util/Permissions.java | 16 +- .../plot/util/UUIDHandlerImplementation.java | 5 +- .../plot/util/expiry/ExpireManager.java | 6 +- .../plot/util/helpmenu/HelpObject.java | 4 +- .../plot/util/helpmenu/HelpPage.java | 10 +- .../util/UUIDHandlerImplementationTest.java | 25 ++ 102 files changed, 1590 insertions(+), 1386 deletions(-) rename Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/{C.java => Captions.java} (98%) create mode 100644 Core/src/test/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementationTest.java diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index 5060e4f4a..de00937f6 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.bukkit.uuid.*; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.IPlotMain; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; @@ -140,7 +140,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain if (Settings.Enabled_Components.METRICS) { this.startMetrics(); } else { - PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName())); + PlotSquared.log(Captions.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName())); } if (Settings.Enabled_Components.WORLDS) { TaskManager.IMP.taskRepeat(this::unload, 20); @@ -238,7 +238,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public void log(@NonNull String message) { try { - message = C.color(message); + message = Captions.color(message); if (!Settings.Chat.CONSOLE_COLOR) { message = ChatColor.stripColor(message); } @@ -287,7 +287,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } @Override @SuppressWarnings("deprecation") public void runEntityTask() { - PlotSquared.log(C.PREFIX + "KillAllEntities started."); + PlotSquared.log(Captions.PREFIX + "KillAllEntities started."); TaskManager.runTaskRepeat(() -> PlotSquared.get().forEachPlotArea(plotArea -> { final World world = Bukkit.getWorld(plotArea.worldname); try { @@ -621,55 +621,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return new BukkitSetupUtils(); } - @Override public UUIDHandlerImplementation initUUIDHandler() { - boolean checkVersion = false; - try { - OfflinePlayer.class.getDeclaredMethod("getUniqueId"); - checkVersion = true; - } catch (Throwable ignore) { - } - final UUIDWrapper wrapper; - if (Settings.UUID.OFFLINE) { - if (Settings.UUID.FORCE_LOWERCASE) { - wrapper = new LowerOfflineUUIDWrapper(); - } else { - wrapper = new OfflineUUIDWrapper(); - } - Settings.UUID.OFFLINE = true; - } else if (checkVersion) { - wrapper = new DefaultUUIDWrapper(); - Settings.UUID.OFFLINE = false; - } else { - if (Settings.UUID.FORCE_LOWERCASE) { - wrapper = new LowerOfflineUUIDWrapper(); - } else { - wrapper = new OfflineUUIDWrapper(); - } - Settings.UUID.OFFLINE = true; - } - if (!checkVersion) { - PlotSquared.log(C.PREFIX - + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature."); - Settings.TITLES = false; - } else { - AbstractTitle.TITLE_CLASS = new DefaultTitle_111(); - if (wrapper instanceof DefaultUUIDWrapper - || wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) { - Settings.UUID.NATIVE_UUID_PROVIDER = true; - } - } - if (Settings.UUID.OFFLINE) { - PlotSquared.log(C.PREFIX + " &6" + getPluginName() - + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " - + "Bukkit"); - } else { - PlotSquared.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs"); - } - if (Settings.UUID.USE_SQLUUIDHANDLER) { - return new SQLUUIDHandler(wrapper); - } else { - return new FileUUIDHandler(wrapper); + @Override public void startMetrics() { + if (this.metricsStarted) { + return; } + System.setProperty("bstats.relocatecheck", + "false"); // We do not want to relocate the package... + Metrics metrics = new Metrics(this);// bstats + PlotSquared.log(Captions.PREFIX + "&6Metrics enabled."); + this.metricsStarted = true; } @Override public ChunkManager initChunkManager() { @@ -700,15 +660,55 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return new BukkitInventoryUtil(); } - @Override public void startMetrics() { - if (this.metricsStarted) { - return; + @Override public UUIDHandlerImplementation initUUIDHandler() { + boolean checkVersion = false; + try { + OfflinePlayer.class.getDeclaredMethod("getUniqueId"); + checkVersion = true; + } catch (Throwable ignore) { + } + final UUIDWrapper wrapper; + if (Settings.UUID.OFFLINE) { + if (Settings.UUID.FORCE_LOWERCASE) { + wrapper = new LowerOfflineUUIDWrapper(); + } else { + wrapper = new OfflineUUIDWrapper(); + } + Settings.UUID.OFFLINE = true; + } else if (checkVersion) { + wrapper = new DefaultUUIDWrapper(); + Settings.UUID.OFFLINE = false; + } else { + if (Settings.UUID.FORCE_LOWERCASE) { + wrapper = new LowerOfflineUUIDWrapper(); + } else { + wrapper = new OfflineUUIDWrapper(); + } + Settings.UUID.OFFLINE = true; + } + if (!checkVersion) { + PlotSquared.log(Captions.PREFIX + + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature."); + Settings.TITLES = false; + } else { + AbstractTitle.TITLE_CLASS = new DefaultTitle_111(); + if (wrapper instanceof DefaultUUIDWrapper + || wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) { + Settings.UUID.NATIVE_UUID_PROVIDER = true; + } + } + if (Settings.UUID.OFFLINE) { + PlotSquared.log(Captions.PREFIX + " &6" + getPluginName() + + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + + "Bukkit"); + } else { + PlotSquared.log(Captions.PREFIX + " &6" + getPluginName() + " is using online UUIDs"); + } + if (Settings.UUID.USE_SQLUUIDHANDLER) { + return new SQLUUIDHandler(wrapper); + } else { + return new FileUUIDHandler(wrapper); } - System.setProperty("bstats.relocatecheck", - "false"); // We do not want to relocate the package... - Metrics metrics = new Metrics(this);// bstats - PlotSquared.log(C.PREFIX + "&6Metrics enabled."); - this.metricsStarted = true; } @Override public void setGenerator(@NonNull final String worldName) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java index ef5b6bdcd..fdee5edf6 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.commands.SubCommand; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -55,14 +55,15 @@ import java.util.Map.Entry; Class clazz = Class.forName(args[0]); newWrapper = (UUIDWrapper) clazz.newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot uuidconvert "); return false; } } if (args.length != 2 || !"-o".equals(args[1])) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot uuidconvert " + args[0] + " - o"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot uuidconvert " + args[0] + " - o"); MainUtil.sendMessage(player, "&cBe aware of the following!"); MainUtil.sendMessage(player, "&8 - &cUse the database command or another method to backup your plots beforehand"); @@ -109,7 +110,8 @@ import java.util.Map.Entry; UUID uuid = UUID.fromString(s); uuids.add(uuid); } catch (Exception ignored) { - MainUtil.sendMessage(player, C.PREFIX + "Invalid playerdata: " + current); + MainUtil.sendMessage(player, + Captions.PREFIX + "Invalid playerdata: " + current); } } } @@ -137,7 +139,7 @@ import java.util.Map.Entry; } } catch (Throwable ignored) { MainUtil.sendMessage(player, - C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat"); + Captions.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat"); } } for (String name : names) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java index af9ed712a..ca389cd30 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -227,8 +227,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (!chunk.isLoaded()) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared - .debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug( + Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -236,8 +236,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (tiles.length == 0) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared - .debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug( + Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -247,8 +247,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (i >= tiles.length) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PlotSquared - .debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug( + Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -273,13 +273,15 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils } } PlotSquared.debug( - C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4) + Captions.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() + << 4) + "," + (chunk.getX() << 4)); } if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { PlotSquared.debug( - C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + ( + Captions.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + + ( chunk.getX() << 4)); cleanChunk(chunk); return true; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java index 97d1bb7d7..d2d588970 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -85,7 +85,8 @@ import java.util.UUID; if (plot.isAdded(uuid)) { Set players = getNearbyPlayers(player, plot); for (PlotPlayer oPlayer : players) { - if (!Permissions.hasPermission(oPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) { + if (!Permissions + .hasPermission(oPlayer, Captions.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) { ((BukkitPlayer) oPlayer).player .setVelocity(calculateVelocity(plotPlayer, oPlayer)); } @@ -95,7 +96,8 @@ import java.util.UUID; if (oPlayer == null) { return; } - if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) { + if (!Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) { player.setVelocity(calculateVelocity(oPlayer, plotPlayer)); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 358605994..5812e4e27 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.bukkit.object.BukkitLazyBlock; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; @@ -453,14 +453,14 @@ import java.util.regex.Pattern; if (shooter instanceof Player) { PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter); if (plot == null) { - if (!Permissions.hasPermission(pp, C.PERMISSION_PROJECTILE_UNOWNED)) { + if (!Permissions.hasPermission(pp, Captions.PERMISSION_PROJECTILE_UNOWNED)) { entity.remove(); return false; } return true; } if (plot.isAdded(pp.getUUID()) || Permissions - .hasPermission(pp, C.PERMISSION_PROJECTILE_OTHER)) { + .hasPermission(pp, Captions.PERMISSION_PROJECTILE_OTHER)) { return true; } entity.remove(); @@ -508,7 +508,7 @@ import java.util.regex.Pattern; case "worldedit:up": case "worldedit:/up": if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions - .hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER, true))) { + .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER, true))) { event.setCancelled(true); return; } @@ -519,7 +519,7 @@ import java.util.regex.Pattern; } Optional> flag = plot.getFlag(Flags.BLOCKED_CMDS); if (flag.isPresent() && !Permissions - .hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { + .hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { List blocked_cmds = flag.get(); String part = parts[0]; if (parts[0].contains(":")) { @@ -569,7 +569,7 @@ import java.util.regex.Pattern; perm = "plots.admin.command.blocked-cmds.other"; } if (!Permissions.hasPermission(pp, perm)) { - MainUtil.sendMessage(pp, C.COMMAND_BLOCKED); + MainUtil.sendMessage(pp, Captions.COMMAND_BLOCKED); event.setCancelled(true); } return; @@ -637,8 +637,8 @@ import java.util.regex.Pattern; if (plot != null) { final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot); if (!result) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, - C.PERMISSION_ADMIN_ENTRY_DENIED); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_ENTRY_DENIED); event.setCancelled(true); if (lastLoc != null) { pp.setMeta(PlotPlayer.META_LOCATION, lastLoc); @@ -760,7 +760,8 @@ import java.util.regex.Pattern; if (now == null) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp .getMeta("kick", false)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_EXIT_DENIED); this.tmpTeleport = false; if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) { player.teleport(from); @@ -774,7 +775,8 @@ import java.util.regex.Pattern; } else if (now.equals(lastPlot)) { ForceFieldListener.handleForcefield(player, pp, now); } else if (!plotEntry(pp, now) && this.tmpTeleport) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_ENTRY_DENIED); this.tmpTeleport = false; to.setX(from.getBlockX()); to.setY(from.getBlockY()); @@ -789,14 +791,14 @@ import java.util.regex.Pattern; this.tmpTeleport = false; player.teleport(event.getTo()); this.tmpTeleport = true; - MainUtil.sendMessage(pp, C.BORDER); + MainUtil.sendMessage(pp, Captions.BORDER); } if (x2 < -border && this.tmpTeleport) { to.setX(-border + 1); this.tmpTeleport = false; player.teleport(event.getTo()); this.tmpTeleport = true; - MainUtil.sendMessage(pp, C.BORDER); + MainUtil.sendMessage(pp, Captions.BORDER); } } int z2; @@ -818,7 +820,8 @@ import java.util.regex.Pattern; if (now == null) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp .getMeta("kick", false)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_EXIT_DENIED); this.tmpTeleport = false; if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) { player.teleport(from); @@ -832,7 +835,8 @@ import java.util.regex.Pattern; } else if (now.equals(lastPlot)) { ForceFieldListener.handleForcefield(player, pp, now); } else if (!plotEntry(pp, now) && this.tmpTeleport) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_ENTRY_DENIED); this.tmpTeleport = false; player.teleport(from); to.setX(from.getBlockX()); @@ -848,13 +852,13 @@ import java.util.regex.Pattern; this.tmpTeleport = false; player.teleport(event.getTo()); this.tmpTeleport = true; - MainUtil.sendMessage(pp, C.BORDER); + MainUtil.sendMessage(pp, Captions.BORDER); } else if (z2 < -border && this.tmpTeleport) { to.setZ(-border + 1); this.tmpTeleport = false; player.teleport(event.getTo()); this.tmpTeleport = true; - MainUtil.sendMessage(pp, C.BORDER); + MainUtil.sendMessage(pp, Captions.BORDER); } } } @@ -876,7 +880,7 @@ import java.util.regex.Pattern; } event.setCancelled(true); String message = event.getMessage(); - String format = C.PLOT_CHAT_FORMAT.s(); + String format = Captions.PLOT_CHAT_FORMAT.s(); String sender = event.getPlayer().getDisplayName(); PlotId id = plot.getId(); Set recipients = event.getRecipients(); @@ -896,14 +900,15 @@ import java.util.regex.Pattern; String partial = ChatColor.translateAlternateColorCodes('&', format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender)); if (plotPlayer.hasPermission("plots.chat.color")) { - message = C.color(message); + message = Captions.color(message); } String full = partial.replace("%msg%", message); for (Player receiver : recipients) { receiver.sendMessage(full); } if (!spies.isEmpty()) { - String spyMessage = C.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y) + String spyMessage = + Captions.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y) .replace("%sender%", sender).replace("%msg%", message); for (Player player : spies) { player.sendMessage(spyMessage); @@ -924,26 +929,27 @@ import java.util.regex.Pattern; PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); if (event.getBlock().getY() == 0) { if (!Permissions - .hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) { - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, - C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL); + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) { + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL); event.setCancelled(true); return; } } else if ( (location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT) && !Permissions - .hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { event.setCancelled(true); - MainUtil.sendMessage(plotPlayer, - C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); + MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.s() + .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { - if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { + if (Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) { return; } - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, - C.PERMISSION_ADMIN_DESTROY_UNOWNED); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_DESTROY_UNOWNED); event.setCancelled(true); return; } @@ -954,16 +960,17 @@ import java.util.regex.Pattern; .contains(PlotBlock.get(block.getType().name()))) { return; } - if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) { + if (Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { return; } - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, - C.PERMISSION_ADMIN_DESTROY_OTHER); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_DESTROY_OTHER); event.setCancelled(true); } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { - if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, - C.PERMISSION_ADMIN_BUILD_OTHER); + if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); return; } @@ -971,7 +978,7 @@ import java.util.regex.Pattern; return; } PlotPlayer pp = BukkitUtil.getPlayer(player); - if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) { + if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) { return; } if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) { @@ -980,7 +987,8 @@ import java.util.regex.Pattern; return; } } - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD); + MainUtil + .sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_DESTROY_ROAD); event.setCancelled(true); } @@ -1051,7 +1059,7 @@ import java.util.regex.Pattern; plotExit(pp, plot); } if (PlotSquared.get().worldedit != null) { - if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) { + if (!Permissions.hasPermission(pp, Captions.PERMISSION_WORLDEDIT_BYPASS)) { if (pp.getAttribute("worldedit")) { pp.removeAttribute("worldedit"); } @@ -1224,7 +1232,8 @@ import java.util.regex.Pattern; } if (!plot.hasOwner()) { PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); - if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { + if (Permissions + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) { return; } event.setCancelled(true); @@ -1236,7 +1245,7 @@ import java.util.regex.Pattern; Block block = event.getBlock(); if (destroy.isPresent() && destroy.get() .contains(PlotBlock.get(block.getType().name())) || Permissions - .hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) { + .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { return; } event.setCancelled(true); @@ -1245,7 +1254,7 @@ import java.util.regex.Pattern; return; } PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); - if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_ROAD)) { + if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) { return; } event.setCancelled(true); @@ -1612,19 +1621,21 @@ import java.util.regex.Pattern; boolean cancelled = false; if (plot == null) { if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road"); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.road"); cancelled = true; } } else if (!plot.hasOwner()) { if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); + MainUtil + .sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); cancelled = true; } } else { UUID uuid = pp.getUUID(); if (!plot.isAdded(uuid)) { if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other"); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + "plots.admin.interact.other"); cancelled = true; } } @@ -1672,12 +1683,13 @@ import java.util.regex.Pattern; PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer()); if (plot == null) { if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road"); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.road"); e.setCancelled(true); } } else if (!plot.hasOwner()) { if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); + MainUtil + .sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); e.setCancelled(true); } } else { @@ -1687,7 +1699,8 @@ import java.util.regex.Pattern; return; } if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other"); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + "plots.admin.interact.other"); e.setCancelled(true); } } @@ -2161,19 +2174,21 @@ import java.util.regex.Pattern; if (player != null) { PlotPlayer pp = BukkitUtil.getPlayer(player); if (plot == null) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_ROAD); event.setCancelled(true); } } else if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } } else if (!plot.isAdded(pp.getUUID())) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); } } else if (Flags.BLOCK_IGNITION.isFalse(plot)) { @@ -2237,29 +2252,33 @@ import java.util.regex.Pattern; PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer()); Plot plot = area.getPlot(location); if (plot == null) { - if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) { + if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { return; } - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_ROAD); event.setCancelled(true); } else if (!plot.hasOwner()) { - if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) { + if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { return; } - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(pp.getUUID())) { if (Flags.USE.contains(plot, PlotBlock.get(event.getBucket().getId(), 0))) { return; } - if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { + if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { return; } - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); } } @@ -2293,17 +2312,18 @@ import java.util.regex.Pattern; PlotPlayer plotPlayer = BukkitUtil.getPlayer(player); Plot plot = area.getPlot(location); if (plot == null) { - if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_ROAD)) { + if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { return; } - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_ROAD); event.setCancelled(true); } else if (!plot.hasOwner()) { - if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_UNOWNED)) { + if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { return; } - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } else if (!plot.isAdded(plotPlayer.getUUID())) { Optional> use = plot.getFlag(Flags.USE); @@ -2311,15 +2331,16 @@ import java.util.regex.Pattern; if (use.isPresent() && use.get().contains(PlotBlock.get(block.getType().name()))) { return; } - if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) { + if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { return; } - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { - if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); } } @@ -2356,24 +2377,25 @@ import java.util.regex.Pattern; PlotPlayer pp = BukkitUtil.getPlayer(p); Plot plot = area.getPlot(location); if (plot == null) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_ROAD); event.setCancelled(true); } } else { if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); } return; } if (!plot.isAdded(pp.getUUID())) { if (!plot.getFlag(Flags.HANGING_PLACE, false)) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); } return; @@ -2399,24 +2421,24 @@ import java.util.regex.Pattern; PlotPlayer pp = BukkitUtil.getPlayer(p); Plot plot = area.getPlot(location); if (plot == null) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_DESTROY_ROAD); event.setCancelled(true); } } else if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_DESTROY_UNOWNED); event.setCancelled(true); } } else if (!plot.isAdded(pp.getUUID())) { if (plot.getFlag(Flags.HANGING_BREAK, false)) { return; } - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_DESTROY_OTHER); event.setCancelled(true); } } @@ -2434,17 +2456,17 @@ import java.util.regex.Pattern; if (plot != null) { if (!plot.hasOwner()) { if (!Permissions - .hasPermission(player, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { - MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT, - C.PERMISSION_ADMIN_DESTROY_UNOWNED); + .hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_DESTROY_UNOWNED); event.setCancelled(true); } } else if (!plot.isAdded(player.getUUID())) { if (!plot.getFlag(Flags.HANGING_BREAK, false)) { if (!Permissions - .hasPermission(player, C.PERMISSION_ADMIN_DESTROY_OTHER)) { - MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT, - C.PERMISSION_ADMIN_DESTROY_OTHER); + .hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_DESTROY_OTHER); event.setCancelled(true); } } @@ -2467,14 +2489,15 @@ import java.util.regex.Pattern; PlotPlayer pp = BukkitUtil.getPlayer(p); Plot plot = area.getPlot(location); if (plot == null) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_ROAD); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_ROAD)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_INTERACT_ROAD); event.setCancelled(true); } } else if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED)) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_UNOWNED); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED); event.setCancelled(true); } } else if (!plot.isAdded(pp.getUUID())) { @@ -2501,8 +2524,9 @@ import java.util.regex.Pattern; if (entity instanceof ItemFrame && plot.getFlag(Flags.MISC_INTERACT, false)) { return; } - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_OTHER); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_OTHER)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_INTERACT_OTHER); event.setCancelled(true); } } @@ -2522,14 +2546,14 @@ import java.util.regex.Pattern; Plot plot = area.getPlot(location); if (plot == null) { if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.road"); + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + "plots.admin.vehicle.break.road"); event.setCancelled(true); } } else { if (!plot.hasOwner()) { if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.unowned"); event.setCancelled(true); return; @@ -2541,7 +2565,7 @@ import java.util.regex.Pattern; return; } if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.other"); event.setCancelled(true); } @@ -2680,7 +2704,7 @@ import java.util.regex.Pattern; return true; } if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) { - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, "plots.admin.destroy." + stub); return false; } @@ -2690,7 +2714,7 @@ import java.util.regex.Pattern; return true; } if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) { - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, "plots.admin.destroy." + stub); return false; } @@ -2701,8 +2725,8 @@ import java.util.regex.Pattern; return true; } if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + "plots.admin.pve." + stub); return false; } } else if (victim instanceof Tameable) { // victim is tameable @@ -2711,15 +2735,15 @@ import java.util.regex.Pattern; return true; } if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + "plots.admin.pve." + stub); return false; } } else if (victim instanceof Player) { if (plot != null) { if (Flags.PVP.isFalse(plot) && !Permissions .hasPermission(plotPlayer, "plots.admin.pvp." + stub)) { - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub); return false; } else { @@ -2727,8 +2751,8 @@ import java.util.regex.Pattern; } } if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) { - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + "plots.admin.pvp." + stub); return false; } } else if (victim instanceof Creature) { // victim is animal @@ -2737,8 +2761,8 @@ import java.util.regex.Pattern; return true; } if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + "plots.admin.pve." + stub); return false; } } else if (victim instanceof Vehicle) { // Vehicles are managed in vehicle destroy event @@ -2749,8 +2773,8 @@ import java.util.regex.Pattern; return true; } if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + "plots.admin.pve." + stub); return false; } } @@ -2775,20 +2799,20 @@ import java.util.regex.Pattern; Plot plot = area.getPlot(location); if (plot == null) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) { - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road"); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + "plots.admin.projectile.road"); event.setHatching(false); } } else if (!plot.hasOwner()) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) { - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, "plots.admin.projectile.unowned"); event.setHatching(false); } } else if (!plot.isAdded(plotPlayer.getUUID())) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) { - MainUtil - .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other"); + MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, + "plots.admin.projectile.other"); event.setHatching(false); } } @@ -2806,15 +2830,15 @@ import java.util.regex.Pattern; Plot plot = area.getPlot(location); if (plot != null) { if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT) - && !Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { + && !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { event.setCancelled(true); - MainUtil.sendMessage(pp, - C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); + MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.s() + .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) { - MainUtil - .sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_UNOWNED); event.setCancelled(true); return; } @@ -2826,14 +2850,16 @@ import java.util.regex.Pattern; return; } } - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); return; } } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { - if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); return; } @@ -2844,8 +2870,9 @@ import java.util.regex.Pattern; sendBlockChange(block.getLocation(), block.getBlockData()); } } - } else if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD); + } else if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + Captions.PERMISSION_ADMIN_BUILD_ROAD); event.setCancelled(true); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index 6de22d4a0..f4e1b8e3c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotBlock; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -100,15 +100,15 @@ public class BukkitPlayer extends PlotPlayer { } @Override public int hasPermissionRange(String stub, int range) { - if (hasPermission(C.PERMISSION_ADMIN.s())) { + if (hasPermission(Captions.PERMISSION_ADMIN.s())) { return Integer.MAX_VALUE; } String[] nodes = stub.split("\\."); StringBuilder n = new StringBuilder(); for (int i = 0; i < (nodes.length - 1); i++) { n.append(nodes[i]).append("."); - if (!stub.equals(n + C.PERMISSION_STAR.s())) { - if (hasPermission(n + C.PERMISSION_STAR.s())) { + if (!stub.equals(n + Captions.PERMISSION_STAR.s())) { + if (hasPermission(n + Captions.PERMISSION_STAR.s())) { return Integer.MAX_VALUE; } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java index 3557f33af..aaf5f4aa5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/schematic/StateWrapper.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.schematic; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.sk89q.jnbt.*; import org.bukkit.Material; import org.bukkit.World; @@ -132,7 +132,7 @@ public class StateWrapper { .replace("\"underlined\":true,", "&n").replace("\"italic\":true,", "&o") .replace("[{\"text\":\"", "&0").replace("{\"text\":\"", "&0").replace("\"},", "") .replace("\"}]", "").replace("\"}", ""); - for (Entry entry : C.replacements.entrySet()) { + for (Entry entry : Captions.replacements.entrySet()) { str = str.replace(entry.getKey(), entry.getValue()); } return str; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java index 009b87ae5..ef3af32d9 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChatManager.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.chat.FancyMessage; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; @@ -21,7 +21,7 @@ public class BukkitChatManager extends ChatManager { } @Override public void color(PlotMessage message, String color) { - message.$(this).color(ChatColor.getByChar(C.color(color).substring(1))); + message.$(this).color(ChatColor.getByChar(Captions.color(color).substring(1))); } @Override public void tooltip(PlotMessage message, PlotMessage... tooltips) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java index 46dd6b6a8..55d3dbc1e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem; import com.github.intellectualsites.plotsquared.plot.util.*; @@ -174,9 +174,9 @@ import java.util.*; * * @param player the recipient of the message * @param caption the message - * @see MainUtil#sendMessage(PlotPlayer, C, String...) + * @see MainUtil#sendMessage(PlotPlayer, Captions, String...) */ - public static void sendMessage(Player player, C caption) { + public static void sendMessage(Player player, Captions caption) { MainUtil.sendMessage(BukkitUtil.getPlayer(player), caption); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 42a83f466..8d2726bfd 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -48,7 +48,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { world = worlds.get(0).getName(); } TaskManager.runTaskAsync(() -> { - PlotSquared.debug(C.PREFIX + "&6Starting player data caching for: " + world); + PlotSquared.debug(Captions.PREFIX + "&6Starting player data caching for: " + world); File uuidFile = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt"); if (uuidFile.exists()) { try { @@ -115,7 +115,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } } catch (Exception e) { e.printStackTrace(); - PlotSquared.debug(C.PREFIX + "Invalid playerdata: " + current); + PlotSquared.debug(Captions.PREFIX + "Invalid playerdata: " + current); } } } @@ -145,7 +145,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { UUID uuid = UUID.fromString(s); uuids.add(uuid); } catch (Exception ignored) { - PlotSquared.debug(C.PREFIX + "Invalid PlayerData: " + current); + PlotSquared.debug(Captions.PREFIX + "Invalid PlayerData: " + current); } } break; @@ -199,8 +199,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } } } catch (Exception ignored) { - PlotSquared - .debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat"); + PlotSquared.debug( + Captions.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat"); } } for (String name : names) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 8df215693..86cd9ae0d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.SQLite; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -153,7 +153,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { } @Override public void fetchUUID(final String name, final RunnableVal ifFetch) { - PlotSquared.debug(C.PREFIX + "UUID for '" + name + PlotSquared.debug(Captions.PREFIX + "UUID for '" + name + "' was null. We'll cache this from the Mojang servers!"); if (ifFetch == null) { return; @@ -196,25 +196,6 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { } } - @Override public boolean add(final StringWrapper name, final UUID uuid) { - // Ignoring duplicates - if (super.add(name, uuid)) { - TaskManager.runTaskAsync(() -> { - try (PreparedStatement statement = getConnection() - .prepareStatement("REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) { - statement.setString(1, uuid.toString()); - statement.setString(2, name.toString()); - statement.execute(); - PlotSquared.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'"); - } catch (SQLException e) { - e.printStackTrace(); - } - }); - return true; - } - return false; - } - /** * This is useful for name changes */ @@ -226,14 +207,34 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { statement.setString(1, name.value); statement.setString(2, uuid.toString()); statement.execute(); - PlotSquared - .debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\''); + PlotSquared.debug( + Captions.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\''); } catch (SQLException e) { e.printStackTrace(); } }); } + @Override public boolean add(final StringWrapper name, final UUID uuid) { + // Ignoring duplicates + if (super.add(name, uuid)) { + TaskManager.runTaskAsync(() -> { + try (PreparedStatement statement = getConnection() + .prepareStatement("REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) { + statement.setString(1, uuid.toString()); + statement.setString(2, name.toString()); + statement.execute(); + PlotSquared + .debug(Captions.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'"); + } catch (SQLException e) { + e.printStackTrace(); + } + }); + return true; + } + return false; + } + private class SQLUUIDHandlerException extends RuntimeException { SQLUUIDHandlerException(String s, Throwable c) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java index 76abc8c7c..d2b4e7343 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.api; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -57,7 +57,7 @@ import java.util.UUID; } /** - * Add a plot world. + * Adds a plot world. * * @param plotArea Plot World Object * @see PlotSquared#addPlotArea(PlotArea) @@ -67,13 +67,13 @@ import java.util.UUID; } /** - * Returns the PlotSquared configurations file. + * Gets the configuration file for this plugin. * - * @return main configuration - * @see PlotSquared#config + * @return the configuration file for PlotSquared + * = */ public YamlConfiguration getConfig() { - return PlotSquared.get().config; + return PlotSquared.get().getConfig(); } /** @@ -151,20 +151,20 @@ import java.util.UUID; * Send a message to the console. The message supports color codes. * * @param message the message - * @see MainUtil#sendConsoleMessage(C, String...) + * @see MainUtil#sendConsoleMessage(Captions, String...) */ public void sendConsoleMessage(String message) { PlotSquared.log(message); } /** - * Send a message to the console. + * Sends a message to the console. * * @param caption the message * @see #sendConsoleMessage(String) - * @see C + * @see Captions */ - public void sendConsoleMessage(C caption) { + public void sendConsoleMessage(Captions caption) { sendConsoleMessage(caption.s()); } 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 51509501e..b637292c1 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 @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotMessage; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; @@ -239,18 +239,19 @@ public abstract class Command { if (page < totalPages && page > 0) { // Back | Next new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ") .color("$3").text("->").color("$1").command(baseCommand + " " + (page + 2)) - .text(C.CLICKABLE.s()).color("$2").send(player); + .text(Captions.CLICKABLE.s()).color("$2").send(player); return; } if (page == 0 && totalPages != 0) { // Next new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1") - .command(baseCommand + " " + (0 + 2)).text(C.CLICKABLE.s()).color("$2") + .command(baseCommand + " " + (0 + 2)).text(Captions.CLICKABLE.s()).color("$2") .send(player); return; } if (page == totalPages && totalPages != 0) { // Back new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ") - .color("$3").text("->").color("$3").text(C.CLICKABLE.s()).color("$2").send(player); + .color("$3").text("->").color("$3").text(Captions.CLICKABLE.s()).color("$2") + .send(player); } } @@ -267,7 +268,7 @@ public abstract class Command { if (this.parent == null) { MainCommand.getInstance().help.displayHelp(player, null, 0); } else { - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); } return; } @@ -279,7 +280,7 @@ public abstract class Command { Command cmd = getCommand(args[0]); if (cmd == null) { if (this.parent != null) { - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return; } // Help command @@ -294,11 +295,11 @@ public abstract class Command { } catch (IllegalArgumentException ignored) { } // Command recommendation - MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND); + MainUtil.sendMessage(player, Captions.NOT_VALID_SUBCOMMAND); List commands = getCommands(player); if (commands.isEmpty()) { - MainUtil - .sendMessage(player, C.DID_YOU_MEAN, MainCommand.getInstance().help.getUsage()); + MainUtil.sendMessage(player, Captions.DID_YOU_MEAN, + MainCommand.getInstance().help.getUsage()); return; } String[] allargs = @@ -313,7 +314,7 @@ public abstract class Command { if (cmd == null) { cmd = new StringComparison<>(args[0], this.allCommands).getMatchObject(); } - MainUtil.sendMessage(player, C.DID_YOU_MEAN, cmd.getUsage()); + MainUtil.sendMessage(player, Captions.DID_YOU_MEAN, cmd.getUsage()); return; } String[] newArgs = Arrays.copyOfRange(args, 1, args.length); @@ -344,7 +345,7 @@ public abstract class Command { failed = failed || reqArgs[i].parse(args[i]) == null; } if (failed) { - C.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " ")); + Captions.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " ")); return false; } } @@ -426,12 +427,13 @@ public abstract class Command { } if (!this.required.allows(player)) { if (message) { - MainUtil.sendMessage(player, - this.required == RequiredType.PLAYER ? C.IS_CONSOLE : C.NOT_CONSOLE); + MainUtil.sendMessage(player, this.required == RequiredType.PLAYER ? + Captions.IS_CONSOLE : + Captions.NOT_CONSOLE); } } else if (!Permissions.hasPermission(player, getPermission())) { if (message) { - C.NO_PERMISSION.send(player, getPermission()); + Captions.NO_PERMISSION.send(player, getPermission()); } } else { return true; @@ -548,13 +550,13 @@ public abstract class Command { return this.getFullId().hashCode(); } - public void checkTrue(boolean mustBeTrue, C message, Object... args) { + public void checkTrue(boolean mustBeTrue, Captions message, Object... args) { if (!mustBeTrue) { throw new CommandException(message, args); } } - public T check(T object, C message, Object... args) { + public T check(T object, Captions message, Object... args) { if (object == null) { throw new CommandException(message, args); } @@ -568,9 +570,9 @@ public abstract class Command { public static class CommandException extends RuntimeException { private final Object[] args; - private final C message; + private final Captions message; - public CommandException(C message, Object... args) { + public CommandException(Captions message, Object... args) { this.message = message; this.args = args; } 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 b82192e96..2e76f6516 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 @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.configuration.serialization.ConfigurationSerialization; import com.github.intellectualsites.plotsquared.plot.commands.WE_Anywhere; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.config.Storage; @@ -42,6 +42,7 @@ import java.util.*; import java.util.Map.Entry; import java.util.function.Consumer; import java.util.regex.Pattern; +import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -64,13 +65,13 @@ import java.util.zip.ZipInputStream; public File commandsFile; public File translationFile; public YamlConfiguration style; - public YamlConfiguration config; public YamlConfiguration worlds; public YamlConfiguration storage; public YamlConfiguration commands; // Temporary hold the plots/clusters before the worlds load public HashMap> clusters_tmp; public HashMap> plots_tmp; + private YamlConfiguration config; // Implementation logger @Setter @Getter private ILogger logger; // Platform / Version / Update URL @@ -129,7 +130,7 @@ import java.util.zip.ZipInputStream; this.translationFile = MainUtil.getFile(this.IMP.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + IMP.getPluginName() + ".use_THIS.yml"); - C.load(this.translationFile); + Captions.load(this.translationFile); // Setup plotAreaManager if (Settings.Enabled_Components.WORLDS) { @@ -158,7 +159,7 @@ import java.util.zip.ZipInputStream; if (Settings.Enabled_Components.METRICS) { this.IMP.startMetrics(); } else { - PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName())); + PlotSquared.log(Captions.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName())); } if (Settings.Enabled_Components.CHUNK_PROCESSOR) { this.IMP.registerChunkProcessor(); @@ -285,7 +286,7 @@ import java.util.zip.ZipInputStream; e.printStackTrace(); } - PlotSquared.log(C.ENABLED.f(IMP.getPluginName())); + PlotSquared.log(Captions.ENABLED.f(IMP.getPluginName())); } /** @@ -801,9 +802,9 @@ import java.util.zip.ZipInputStream; } /** - * Gets all the plots in a single set. + * Gets all the plots across all plotworlds in one {@code Set}. * - * @return Set of Plots + * @return all the plots on the server loaded by this plugin */ public Set getPlots() { int size = getPlotCount(); @@ -886,12 +887,9 @@ import java.util.zip.ZipInputStream; * @return Set of plot */ public Set getPlots(String world, UUID uuid) { - final Set plots = new HashSet<>(); - for (final Plot plot : getPlots(world)) { - if (plot.hasOwner() && plot.isOwnerAbs(uuid)) { - plots.add(plot); - } - } + final Set plots = + getPlots(world).stream().filter(plot -> plot.hasOwner() && plot.isOwnerAbs(uuid)) + .collect(Collectors.toSet()); return Collections.unmodifiableSet(plots); } @@ -999,7 +997,7 @@ import java.util.zip.ZipInputStream; } /** - * Unregister a plot from local memory (does not call DB). + * Unregisters a plot from local memory without calling the database. * * @param plot the plot to remove * @param callEvent If to call an event about the plot being removed @@ -1091,11 +1089,12 @@ import java.util.zip.ZipInputStream; // Conventional plot generator PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null); PlotManager plotManager = plotGenerator.getNewPlotManager(); - PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'"); - PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator); - PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName()); + PlotSquared.log(Captions.PREFIX + "&aDetected world load for '" + world + "'"); PlotSquared - .log(C.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName()); + .log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator); + PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName()); + PlotSquared.log( + Captions.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName()); if (!this.worlds.contains(path)) { this.worlds.createSection(path); worldSection = this.worlds.getConfigurationSection(path); @@ -1120,7 +1119,7 @@ import java.util.zip.ZipInputStream; debug("World possibly already loaded: " + world); return; } - PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'"); + PlotSquared.log(Captions.PREFIX + "&aDetected world load for '" + world + "'"); String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName()); if (type == 2) { Set clusters = @@ -1137,7 +1136,7 @@ import java.util.zip.ZipInputStream; worldSection.createSection("areas." + fullId); DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE - PlotSquared.log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2); + PlotSquared.log(Captions.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2); GeneratorWrapper areaGen = this.IMP.getGenerator(world, gen_string); if (areaGen == null) { throw new IllegalArgumentException("Invalid Generator: " + gen_string); @@ -1151,11 +1150,13 @@ import java.util.zip.ZipInputStream; } catch (IOException e) { e.printStackTrace(); } + PlotSquared.log( + Captions.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + + areaGen); + PlotSquared.log(Captions.PREFIX + "&c | &9plotworld: &7" + pa); + PlotSquared.log(Captions.PREFIX + "&c | &9manager: &7" + pa); PlotSquared - .log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); - PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa); - PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa); - PlotSquared.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name + .log(Captions.PREFIX + "&cNote: &7Area created for cluster:" + name + " (invalid or old configuration?)"); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); @@ -1178,9 +1179,10 @@ import java.util.zip.ZipInputStream; } catch (IOException e) { e.printStackTrace(); } - PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen); - PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + pa); - PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager()); + PlotSquared + .log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen); + PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + pa); + PlotSquared.log(Captions.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager()); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); addPlotArea(pa); @@ -1191,7 +1193,7 @@ import java.util.zip.ZipInputStream; "Invalid type for multi-area world. Expected `2`, got `" + 1 + "`"); } for (String areaId : areasSection.getKeys(false)) { - PlotSquared.log(C.PREFIX + "&3 - " + areaId); + PlotSquared.log(Captions.PREFIX + "&3 - " + areaId); String[] split = areaId.split("(?<=[^;-])-"); if (split.length != 3) { throw new IllegalArgumentException("Invalid Area identifier: " + areaId @@ -1253,10 +1255,11 @@ import java.util.zip.ZipInputStream; } catch (IOException e) { e.printStackTrace(); } - PlotSquared.log(C.PREFIX + "&aDetected area load for '" + world + "'"); - PlotSquared.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); - PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa); - PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager()); + PlotSquared.log(Captions.PREFIX + "&aDetected area load for '" + world + "'"); + PlotSquared + .log(Captions.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); + PlotSquared.log(Captions.PREFIX + "&c | &9plotworld: &7" + pa); + PlotSquared.log(Captions.PREFIX + "&c | &9manager: &7" + pa.getPlotManager()); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); addPlotArea(pa); @@ -1403,20 +1406,16 @@ import java.util.zip.ZipInputStream; public String normalisedVersion(@NonNull final String version) { final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version); - final StringBuilder sb = new StringBuilder(); - for (final String s : split) { - sb.append(String.format("%" + 4 + 's', s)); - } - return sb.toString(); + return Arrays.stream(split).map(s -> String.format("%4s", s)).collect(Collectors.joining()); } - public boolean update(PlotPlayer sender, URL url) { + private boolean update(PlotPlayer sender, URL url) { try { String name = this.jarFile.getName(); - File newJar = new File("plugins/update/" + name); MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url); URLConnection con = url.openConnection(); try (InputStream stream = con.getInputStream()) { + File newJar = new File("plugins/update/" + name); File parent = newJar.getParentFile(); if (!parent.exists()) { parent.mkdirs(); @@ -1443,7 +1442,7 @@ import java.util.zip.ZipInputStream; } /** - * Copy a file from inside the jar to a location + * Copies a file from inside the jar to a location * * @param file Name of the file inside PlotSquared.jar * @param folder The output location relative to /plugins/PlotSquared/ @@ -1511,7 +1510,7 @@ import java.util.zip.ZipInputStream; } /** - * Close the database connection. + * Safely closes the database connection. */ public void disable() { try { @@ -1548,7 +1547,7 @@ import java.util.zip.ZipInputStream; File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db"); database = new SQLite(file); } else { - PlotSquared.log(C.PREFIX + "&cNo storage type is set!"); + PlotSquared.log(Captions.PREFIX + "&cNo storage type is set!"); this.IMP.shutdown(); //shutdown used instead of disable because no database is set return; } @@ -1566,8 +1565,8 @@ import java.util.zip.ZipInputStream; } this.clusters_tmp = DBFunc.getClusters(); } catch (ClassNotFoundException | SQLException e) { - PlotSquared.log( - C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself."); + PlotSquared.log(Captions.PREFIX + + "&cFailed to open DATABASE connection. The plugin will disable itself."); if (Storage.MySQL.USE) { PlotSquared.log("$4MYSQL"); } else if (Storage.SQLite.USE) { @@ -1589,15 +1588,16 @@ import java.util.zip.ZipInputStream; * @throws IOException if the config failed to save */ public void setupConfig() throws IOException { - String lastVersionString = this.config.getString("version"); + String lastVersionString = this.getConfig().getString("version"); if (lastVersionString != null) { String[] split = lastVersionString.split("\\."); int[] lastVersion = new int[] {Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2])}; if (checkVersion(new int[] {3, 4, 0}, lastVersion)) { Settings.convertLegacy(configFile); - if (config.contains("worlds")) { - ConfigurationSection worldSection = config.getConfigurationSection("worlds"); + if (getConfig().contains("worlds")) { + ConfigurationSection worldSection = + getConfig().getConfigurationSection("worlds"); worlds.set("worlds", worldSection); try { worlds.save(worldsFile); @@ -1639,7 +1639,7 @@ import java.util.zip.ZipInputStream; public boolean setupConfigs() { File folder = new File(this.IMP.getDirectory(), "config"); if (!folder.exists() && !folder.mkdirs()) { - PlotSquared.log(C.PREFIX + PlotSquared.log(Captions.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually."); } try { @@ -1655,11 +1655,11 @@ import java.util.zip.ZipInputStream; .getString("configuration_version") .equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION)) { // Conversion needed - log(C.LEGACY_CONFIG_FOUND.s()); + log(Captions.LEGACY_CONFIG_FOUND.s()); try { com.google.common.io.Files .copy(this.worldsFile, new File(folder, "worlds.yml.old")); - log(C.LEGACY_CONFIG_BACKUP.s()); + log(Captions.LEGACY_CONFIG_BACKUP.s()); final ConfigurationSection worlds = this.worlds.getConfigurationSection("worlds"); final LegacyConverter converter = new LegacyConverter(worlds); @@ -1668,9 +1668,9 @@ import java.util.zip.ZipInputStream; .set("configuration_version", LegacyConverter.CONFIGURATION_VERSION); this.worlds.set("worlds", worlds); // Redundant, but hey... ¯\_(ツ)_/¯ this.worlds.save(this.worldsFile); - log(C.LEGACY_CONFIG_DONE.s()); + log(Captions.LEGACY_CONFIG_DONE.s()); } catch (final Exception e) { - log(C.LEGACY_CONFIG_CONVERSION_FAILED.s()); + log(Captions.LEGACY_CONFIG_CONVERSION_FAILED.s()); e.printStackTrace(); } // Disable plugin @@ -1759,7 +1759,7 @@ import java.util.zip.ZipInputStream; if (Settings.DEBUG) { Map components = Settings.getFields(Settings.Enabled_Components.class); for (Entry component : components.entrySet()) { - PlotSquared.log(C.PREFIX + String + PlotSquared.log(Captions.PREFIX + String .format("&cKey: &6%s&c, Value: &6%s", component.getKey(), component.getValue())); } @@ -1790,7 +1790,7 @@ import java.util.zip.ZipInputStream; * * @return the java version */ - public double getJavaVersion() { + private double getJavaVersion() { return Double.parseDouble(System.getProperty("java.specification.version")); } @@ -1800,36 +1800,36 @@ import java.util.zip.ZipInputStream; } } - public void forEachPlotArea(@NonNull final String world, Consumer runnable) { + public void forEachPlotArea(@NonNull final String world, Consumer consumer) { final PlotArea[] array = this.plotAreaManager.getPlotAreas(world, null); if (array == null) { return; } for (final PlotArea area : array) { - runnable.accept(area); + consumer.accept(area); } } - public void forEachPlot(Consumer runnable) { + public void forEachPlot(Consumer consumer) { for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { - area.getPlots().forEach(runnable); + area.getPlots().forEach(consumer); } } - public void forEachPlotRaw(Consumer runnable) { + public void forEachPlotRaw(Consumer consumer) { for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { - area.getPlots().forEach(runnable); + area.getPlots().forEach(consumer); } if (this.plots_tmp != null) { for (final HashMap entry : this.plots_tmp.values()) { - entry.values().forEach(runnable); + entry.values().forEach(consumer); } } } - public void forEachBasePlot(Consumer run) { + public void forEachBasePlot(Consumer consumer) { for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { - area.forEachBasePlot(run); + area.forEachBasePlot(consumer); } } @@ -1961,6 +1961,10 @@ import java.util.zip.ZipInputStream; return Collections.unmodifiableSet(set); } + public YamlConfiguration getConfig() { + return config; + } + public enum SortType { CREATION_DATE, CREATION_DATE_TIMESTAMP, LAST_MODIFIED, DISTANCE_FROM_ORIGIN } 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 03d27555a..b5bbbd2e0 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -28,31 +28,32 @@ import java.util.UUID; @Override public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); - checkTrue(plot.hasOwner(), C.PLOT_UNOWNED); + final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); + checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED); checkTrue(plot.isOwner(player.getUUID()) || Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS); - checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage()); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST), + Captions.NO_PLOT_PERMS); + checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage()); final Set uuids = MainUtil.getUUIDsFromString(args[0]); - checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]); + checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]); Iterator iter = uuids.iterator(); int size = plot.getTrusted().size() + plot.getMembers().size(); while (iter.hasNext()) { UUID uuid = iter.next(); if (uuid == DBFunc.EVERYONE && !( - Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); + Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) { + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid)); iter.remove(); continue; } if (plot.isOwner(uuid)) { - MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); iter.remove(); continue; } if (plot.getMembers().contains(uuid)) { - MainUtil.sendMessage(player, C.ALREADY_ADDED, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); iter.remove(); continue; } @@ -60,7 +61,8 @@ import java.util.UUID; } checkTrue(!uuids.isEmpty(), null); checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST), + Captions.PLOT_MAX_MEMBERS); confirm.run(this, new Runnable() { @Override // Success public void run() { @@ -74,7 +76,7 @@ import java.util.UUID; } plot.addMember(uuid); EventUtil.manager.callMember(player, plot, uuid, true); - MainUtil.sendMessage(player, C.MEMBER_ADDED); + MainUtil.sendMessage(player, Captions.MEMBER_ADDED); } } }, null); 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 2eeb0a49d..3602bda5e 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -21,23 +21,23 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; @Override public boolean onCommand(PlotPlayer player, String[] args) { if (args.length == 0) { - C.COMMAND_SYNTAX.send(player, "/plot alias "); + Captions.COMMAND_SYNTAX.send(player, "/plot alias "); return false; } Location loc = player.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - sendMessage(player, C.PLOT_NOT_CLAIMED); + sendMessage(player, Captions.PLOT_NOT_CLAIMED); return false; } if (!plot.isOwner(player.getUUID())) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } @@ -46,25 +46,25 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; switch (args[0].toLowerCase()) { case "set": if (args.length != 2) { - C.COMMAND_SYNTAX.send(player, "/plot alias "); + Captions.COMMAND_SYNTAX.send(player, "/plot alias "); return false; } - if (canExecuteCommand(player, C.PERMISSION_ALIAS_SET, false) || canExecuteCommand( - player, C.PERMISSION_ALIAS_SET_OBSOLETE, false)) { + if (canExecuteCommand(player, Captions.PERMISSION_ALIAS_SET, false) + || canExecuteCommand(player, Captions.PERMISSION_ALIAS_SET_OBSOLETE, false)) { result = setAlias(player, plot, args[1]); } else { - MainUtil.sendMessage(player, C.NO_PERMISSION); + MainUtil.sendMessage(player, Captions.NO_PERMISSION); } break; case "remove": - if (canExecuteCommand(player, C.PERMISSION_ALIAS_REMOVE, true)) { + if (canExecuteCommand(player, Captions.PERMISSION_ALIAS_REMOVE, true)) { result = removeAlias(player, plot); } break; default: - C.COMMAND_SYNTAX.send(player, "/plot alias "); + Captions.COMMAND_SYNTAX.send(player, "/plot alias "); result = false; } @@ -74,47 +74,47 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; private boolean setAlias(PlotPlayer player, Plot plot, String alias) { if (alias.isEmpty()) { - C.COMMAND_SYNTAX.send(player, "/plot alias "); + Captions.COMMAND_SYNTAX.send(player, "/plot alias "); return false; } if (alias.length() >= 50) { - MainUtil.sendMessage(player, C.ALIAS_TOO_LONG); + MainUtil.sendMessage(player, Captions.ALIAS_TOO_LONG); return false; } if (alias.contains(" ")) { - C.NOT_VALID_VALUE.send(player); + Captions.NOT_VALID_VALUE.send(player); return false; } if (MathMan.isInteger(alias)) { - C.NOT_VALID_VALUE.send(player); + Captions.NOT_VALID_VALUE.send(player); return false; } for (Plot p : PlotSquared.get().getPlots(plot.getArea())) { if (p.getAlias().equalsIgnoreCase(alias)) { - MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN); + MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN); return false; } } if (UUIDHandler.nameExists(new StringWrapper(alias)) || PlotSquared.get() .hasPlotArea(alias)) { - MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN); + MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN); return false; } plot.setAlias(alias); - MainUtil.sendMessage(player, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias)); + MainUtil.sendMessage(player, Captions.ALIAS_SET_TO.s().replaceAll("%alias%", alias)); return true; } private boolean removeAlias(PlotPlayer player, Plot plot) { plot.setAlias(null); - MainUtil.sendMessage(player, C.ALIAS_REMOVED.s()); + MainUtil.sendMessage(player, Captions.ALIAS_REMOVED.s()); return true; } - private boolean canExecuteCommand(PlotPlayer player, C caption, boolean sendMessage) { + private boolean canExecuteCommand(PlotPlayer player, Captions caption, boolean sendMessage) { if (!Permissions.hasPermission(player, caption)) { if (sendMessage) { - MainUtil.sendMessage(player, C.NO_PERMISSION); + MainUtil.sendMessage(player, Captions.NO_PERMISSION); } return false; } 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 0427b8926..933938e2e 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; @@ -20,20 +20,20 @@ public class Area extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length == 0) { - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } switch (args[0].toLowerCase()) { case "c": case "setup": case "create": - if (!Permissions.hasPermission(player, C.PERMISSION_AREA_CREATE)) { - C.NO_PERMISSION.send(player, C.PERMISSION_AREA_CREATE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_CREATE)) { + Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_CREATE); return false; } switch (args.length) { case 1: - C.COMMAND_SYNTAX + Captions.COMMAND_SYNTAX .send(player, "/plot area create [world[:id]] [=]..."); return false; case 2: @@ -41,13 +41,13 @@ public class Area extends SubCommand { case "pos1": { // Set position 1 HybridPlotWorld area = player.getMeta("area_create_area"); if (area == null) { - C.COMMAND_SYNTAX.send(player, + Captions.COMMAND_SYNTAX.send(player, "/plot area create [world[:id]] [=]..."); return false; } Location location = player.getLocation(); player.setMeta("area_pos1", location); - C.SET_ATTRIBUTE.send(player, "area_pos1", + Captions.SET_ATTRIBUTE.send(player, "area_pos1", location.getX() + "," + location.getZ()); MainUtil.sendMessage(player, "You will now set pos2: /plot area create pos2" @@ -57,7 +57,7 @@ public class Area extends SubCommand { case "pos2": // Set position 2 and finish creation for type=2 (partial) final HybridPlotWorld area = player.getMeta("area_create_area"); if (area == null) { - C.COMMAND_SYNTAX.send(player, + Captions.COMMAND_SYNTAX.send(player, "/plot area create [world[:id]] [=]..."); return false; } @@ -84,7 +84,7 @@ public class Area extends SubCommand { Set areas = PlotSquared.get().getPlotAreas(area.worldname, region); if (!areas.isEmpty()) { - C.CLUSTER_INTERSECTION + Captions.CLUSTER_INTERSECTION .send(player, areas.iterator().next().toString()); return false; } @@ -113,7 +113,7 @@ public class Area extends SubCommand { final String world = SetupUtils.manager.setupWorld(object); if (WorldUtil.IMP.isWorld(world)) { PlotSquared.get().loadWorld(world, null); - C.SETUP_FINISHED.send(player); + Captions.SETUP_FINISHED.send(player); player.teleport(WorldUtil.IMP.getSpawn(world)); if (area.TERRAIN != 3) { ChunkManager.largeRegionTask(world, region, @@ -153,7 +153,7 @@ public class Area extends SubCommand { PlotSquared.get().IMP.getDefaultGenerator(), null, null); PlotArea other = PlotSquared.get().getPlotArea(pa.worldname, id); if (other != null && Objects.equals(pa.id, other.id)) { - C.SETUP_WORLD_TAKEN.send(player, pa.toString()); + Captions.SETUP_WORLD_TAKEN.send(player, pa.toString()); return false; } Set areas = PlotSquared.get().getPlotAreas(pa.worldname); @@ -165,7 +165,7 @@ public class Area extends SubCommand { for (int i = 2; i < args.length; i++) { String[] pair = args[i].split("="); if (pair.length != 2) { - C.COMMAND_SYNTAX.send(player, getCommandString() + Captions.COMMAND_SYNTAX.send(player, getCommandString() + " create [world[:id]] [=]..."); return false; } @@ -213,14 +213,14 @@ public class Area extends SubCommand { object.type = pa.TYPE; break; default: - C.COMMAND_SYNTAX.send(player, getCommandString() + Captions.COMMAND_SYNTAX.send(player, getCommandString() + " create [world[:id]] [=]..."); return false; } } if (pa.TYPE != 2) { if (WorldUtil.IMP.isWorld(pa.worldname)) { - C.SETUP_WORLD_TAKEN.send(player, pa.worldname); + Captions.SETUP_WORLD_TAKEN.send(player, pa.worldname); return false; } Runnable run = () -> { @@ -236,7 +236,7 @@ public class Area extends SubCommand { object.setupGenerator = PlotSquared.imp().getPluginName(); String world = SetupUtils.manager.setupWorld(object); if (WorldUtil.IMP.isWorld(world)) { - C.SETUP_FINISHED.send(player); + Captions.SETUP_FINISHED.send(player); player.teleport(WorldUtil.IMP.getSpawn(world)); } else { MainUtil.sendMessage(player, @@ -258,7 +258,7 @@ public class Area extends SubCommand { return true; } if (pa.id == null) { - C.COMMAND_SYNTAX.send(player, getCommandString() + Captions.COMMAND_SYNTAX.send(player, getCommandString() + " create [world[:id]] [=]..."); return false; } @@ -281,8 +281,8 @@ public class Area extends SubCommand { return true; case "i": case "info": { - if (!Permissions.hasPermission(player, C.PERMISSION_AREA_INFO)) { - C.NO_PERMISSION.send(player, C.PERMISSION_AREA_INFO); + if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_INFO)) { + Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_INFO); return false; } PlotArea area; @@ -294,14 +294,14 @@ public class Area extends SubCommand { area = PlotSquared.get().getPlotAreaByString(args[1]); break; default: - C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]"); + Captions.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]"); return false; } if (area == null) { if (args.length == 2) { - C.NOT_VALID_PLOT_WORLD.send(player, args[1]); + Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]); } else { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); } return false; } @@ -328,13 +328,14 @@ public class Area extends SubCommand { + "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + "\n$1Region: $2" + region + "\n$1Generator: $2" + generator; MainUtil.sendMessage(player, - C.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + C.PLOT_INFO_FOOTER.s(), false); + Captions.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER + .s(), false); return true; } case "l": case "list": - if (!Permissions.hasPermission(player, C.PERMISSION_AREA_LIST)) { - C.NO_PERMISSION.send(player, C.PERMISSION_AREA_LIST); + if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_LIST)) { + Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_LIST); return false; } int page; @@ -348,7 +349,7 @@ public class Area extends SubCommand { break; } default: - C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]"); + Captions.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]"); return false; } ArrayList areas = new ArrayList<>(PlotSquared.get().getPlotAreas()); @@ -390,19 +391,19 @@ public class Area extends SubCommand { .color("$1").text(" - ").color("$2") .text(area.TYPE + ":" + area.TERRAIN).color("$3"); } - }, "/plot area list", C.AREA_LIST_HEADER_PAGED.s()); + }, "/plot area list", Captions.AREA_LIST_HEADER_PAGED.s()); return true; case "regen": case "clear": case "reset": case "regenerate": { - if (!Permissions.hasPermission(player, C.PERMISSION_AREA_REGEN)) { - C.NO_PERMISSION.send(player, C.PERMISSION_AREA_REGEN); + if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_REGEN)) { + Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_REGEN); return false; } final PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); return false; } if (area.TYPE != 2) { @@ -423,17 +424,17 @@ public class Area extends SubCommand { case "teleport": case "visit": case "tp": - if (!Permissions.hasPermission(player, C.PERMISSION_AREA_TP)) { - C.NO_PERMISSION.send(player, C.PERMISSION_AREA_TP); + if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_TP)) { + Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_TP); return false; } if (args.length != 2) { - C.COMMAND_SYNTAX.send(player, "/plot visit [area]"); + Captions.COMMAND_SYNTAX.send(player, "/plot visit [area]"); return false; } PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]); if (area == null) { - C.NOT_VALID_PLOT_WORLD.send(player, args[1]); + Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]); return false; } Location center; @@ -459,7 +460,7 @@ public class Area extends SubCommand { + "\n$1Stop the server and delete it from these locations."); return true; } - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } 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 690c1098f..833e02968 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -30,14 +30,14 @@ public class Auto extends SubCommand { int diff = currentPlots - allowed_plots; if (diff + size_x * size_z > 0) { if (diff < 0) { - MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, -diff + ""); + MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS_NUM, -diff + ""); return false; } else if (player.hasPersistentMeta("grantedPlots")) { int grantedPlots = ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots")); if (grantedPlots - diff < size_x * size_z) { player.removePersistentMeta("grantedPlots"); - MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS); + MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS); return false; } else { int left = grantedPlots - diff - size_x * size_z; @@ -47,11 +47,11 @@ public class Auto extends SubCommand { player.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(left)); } - MainUtil.sendMessage(player, C.REMOVED_GRANTED_PLOT, "" + left, + MainUtil.sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "" + left, "" + (grantedPlots - left)); } } else { - MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS); + MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS); return false; } } @@ -106,7 +106,7 @@ public class Auto extends SubCommand { @Override public void run(Object ignore) { player.deleteMeta(Auto.class.getName()); if (plot == null) { - MainUtil.sendMessage(player, C.NO_FREE_PLOTS); + MainUtil.sendMessage(player, Captions.NO_FREE_PLOTS); } else if (checkAllowedPlots(player, area, allowed_plots, 1, 1)) { plot.claim(player, true, schem, false); if (area.AUTO_MERGE) { @@ -150,7 +150,7 @@ public class Auto extends SubCommand { } } if (plotarea == null) { - MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD); + MainUtil.sendMessage(player, Captions.NOT_IN_PLOT_WORLD); return false; } } @@ -158,7 +158,7 @@ public class Auto extends SubCommand { int size_z = 1; String schematic = null; if (args.length > 0) { - if (Permissions.hasPermission(player, C.PERMISSION_AUTO_MEGA)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_AUTO_MEGA)) { try { String[] split = args[0].split(",|;"); size_x = Integer.parseInt(split[0]); @@ -179,12 +179,12 @@ public class Auto extends SubCommand { } } else { schematic = args[0]; - // PlayerFunctions.sendMessage(plr, C.NO_PERMISSION); + // PlayerFunctions.sendMessage(plr, Captions.NO_PERMISSION); // return false; } } if (size_x * size_z > Settings.Claim.MAX_AUTO_AREA) { - MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, + MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS_NUM, Settings.Claim.MAX_AUTO_AREA + ""); return false; } @@ -196,13 +196,14 @@ public class Auto extends SubCommand { if (schematic != null && !schematic.isEmpty()) { if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) { - sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic); + sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic); return true; } - if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) - && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) + && !Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)); return true; } } @@ -214,11 +215,11 @@ public class Auto extends SubCommand { cost = (size_x * size_z) * cost; if (cost > 0d) { if (EconHandler.manager.getMoney(player) < cost) { - sendMessage(player, C.CANNOT_AFFORD_PLOT, "" + cost); + sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost); return true; } EconHandler.manager.withdrawMoney(player, cost); - sendMessage(player, C.REMOVED_BALANCE, cost + ""); + sendMessage(player, Captions.REMOVED_BALANCE, cost + ""); } } // TODO handle type 2 the same as normal worlds! @@ -227,7 +228,7 @@ public class Auto extends SubCommand { return true; } else { if (plotarea.TYPE == 2) { - MainUtil.sendMessage(player, C.NO_FREE_PLOTS); + MainUtil.sendMessage(player, Captions.NO_FREE_PLOTS); return false; } while (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 82a573949..6f80ba6c5 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -17,20 +17,20 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; int biome = WorldUtil.IMP.getBiomeFromString(value); if (biome == -1) { String biomes = - StringMan.join(WorldUtil.IMP.getBiomeList(), C.BLOCK_LIST_SEPARATER.s()); - C.NEED_BIOME.send(player); - MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); + StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s()); + Captions.NEED_BIOME.send(player); + MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return false; } plot.addRunning(); plot.setBiome(value.toUpperCase(), new Runnable() { @Override public void run() { plot.removeRunning(); - MainUtil.sendMessage(player, C.BIOME_SET_TO.s() + value.toLowerCase()); + MainUtil.sendMessage(player, Captions.BIOME_SET_TO.s() + value.toLowerCase()); } }); return true; 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 8ba07d900..7b1b75432 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -26,39 +26,39 @@ import java.util.Set; @Override public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, final RunnableVal2 whenDone) { - check(EconHandler.manager, C.ECON_DISABLED); + check(EconHandler.manager, Captions.ECON_DISABLED); final Plot plot; if (args.length != 0) { - checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage()); + checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage()); plot = check(MainUtil.getPlotFromString(player, args[0], true), null); } else { - plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); + plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); } - checkTrue(plot.hasOwner(), C.PLOT_UNOWNED); - checkTrue(!plot.isOwner(player.getUUID()), C.CANNOT_BUY_OWN); + checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED); + checkTrue(!plot.isOwner(player.getUUID()), Captions.CANNOT_BUY_OWN); Set plots = plot.getConnectedPlots(); checkTrue(player.getPlotCount() + plots.size() <= player.getAllowedPlots(), - C.CANT_CLAIM_MORE_PLOTS); + Captions.CANT_CLAIM_MORE_PLOTS); Optional flag = plot.getFlag(Flags.PRICE); if (!flag.isPresent()) { - throw new CommandException(C.NOT_FOR_SALE); + throw new CommandException(Captions.NOT_FOR_SALE); } final double price = flag.get(); - checkTrue(player.getMoney() >= price, C.CANNOT_AFFORD_PLOT); + checkTrue(player.getMoney() >= price, Captions.CANNOT_AFFORD_PLOT); player.withdraw(price); // Failure // Success confirm.run(this, () -> { - C.REMOVED_BALANCE.send(player, price); + Captions.REMOVED_BALANCE.send(player, price); EconHandler.manager .depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.owner), price); PlotPlayer owner = UUIDHandler.getPlayer(plot.owner); if (owner != null) { - C.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price); + Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price); } plot.removeFlag(Flags.PRICE); plot.setOwner(player.getUUID()); - C.CLAIMED.send(player); + Captions.CLAIMED.send(player); whenDone.run(Buy.this, CommandResult.SUCCESS); }, () -> { player.deposit(price); 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 e49155b8d..b06e0b57b 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -23,7 +23,7 @@ public class Claim extends SubCommand { Location loc = player.getLocation(); final Plot plot = loc.getPlotAbs(); if (plot == null) { - return sendMessage(player, C.NOT_IN_PLOT); + return sendMessage(player, Captions.NOT_IN_PLOT); } int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); @@ -34,40 +34,43 @@ public class Claim extends SubCommand { ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots")); if (grants <= 0) { player.removePersistentMeta("grantedPlots"); - return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS); + return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS); } } else { - return sendMessage(player, C.CANT_CLAIM_MORE_PLOTS); + return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS); } } if (!plot.canClaim(player)) { - return sendMessage(player, C.PLOT_IS_CLAIMED); + return sendMessage(player, Captions.PLOT_IS_CLAIMED); } final PlotArea area = plot.getArea(); if (!schematic.isEmpty()) { if (area.SCHEMATIC_CLAIM_SPECIFY) { if (!area.SCHEMATICS.contains(schematic.toLowerCase())) { - return sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic); + return sendMessage(player, Captions.SCHEMATIC_INVALID, + "non-existent: " + schematic); } - if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) - && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { - return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) + && !Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { + return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic); } } } int border = area.getBorder(); if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border) { - return !sendMessage(player, C.BORDER); + return !sendMessage(player, Captions.BORDER); } if ((EconHandler.manager != null) && area.USE_ECONOMY) { Expression costExr = area.PRICES.get("claim"); double cost = costExr.evaluate((double) currentPlots); if (cost > 0d) { if (EconHandler.manager.getMoney(player) < cost) { - return sendMessage(player, C.CANNOT_AFFORD_PLOT, "" + cost); + return sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost); } EconHandler.manager.withdrawMoney(player, cost); - sendMessage(player, C.REMOVED_BALANCE, cost + ""); + sendMessage(player, Captions.REMOVED_BALANCE, cost + ""); } } if (grants > 0) { @@ -77,7 +80,7 @@ public class Claim extends SubCommand { player.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(grants - 1)); } - sendMessage(player, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1)); + sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1)); } if (plot.canClaim(player)) { plot.owner = player.getUUID(); @@ -89,10 +92,10 @@ public class Claim extends SubCommand { plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true); } } - }), () -> sendMessage(player, C.PLOT_NOT_CLAIMED)); + }), () -> sendMessage(player, Captions.PLOT_NOT_CLAIMED)); return true; } else { - sendMessage(player, C.PLOT_NOT_CLAIMED); + sendMessage(player, Captions.PLOT_NOT_CLAIMED); } return false; } 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 efd6b1525..c16b603ac 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; @@ -28,13 +28,14 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue @Override public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage()); - final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); + checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage()); + final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); checkTrue(plot.isOwner(player.getUUID()) || Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CLEAR), C.NO_PLOT_PERMS); - checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CLEAR), + Captions.NO_PLOT_PERMS); + checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER); checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions - .hasPermission(player, C.PERMISSION_CONTINUE), C.DONE_ALREADY_DONE); + .hasPermission(player, Captions.PERMISSION_CONTINUE), Captions.DONE_ALREADY_DONE); confirm.run(this, new Runnable() { @Override public void run() { final long start = System.currentTimeMillis(); @@ -51,14 +52,14 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue if (plot.getFlag(Flags.ANALYSIS).isPresent()) { FlagManager.removePlotFlag(plot, Flags.ANALYSIS); } - MainUtil.sendMessage(player, C.CLEARING_DONE, + MainUtil.sendMessage(player, Captions.CLEARING_DONE, "" + (System.currentTimeMillis() - start)); } }); } }); if (!result) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); } else { plot.addRunning(); } 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 914b04c3c..6ea60a37e 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -25,56 +25,59 @@ import java.util.UUID; // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome if (args.length == 0) { // return arguments - MainUtil.sendMessage(player, C.CLUSTER_AVAILABLE_ARGS); + MainUtil.sendMessage(player, Captions.CLUSTER_AVAILABLE_ARGS); return false; } String sub = args[0].toLowerCase(); switch (sub) { case "l": case "list": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LIST)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LIST); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LIST)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_LIST); return false; } if (args.length != 1) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster list"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster list"); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); return false; } Set clusters = area.getClusters(); - MainUtil.sendMessage(player, C.CLUSTER_LIST_HEADING, clusters.size() + ""); + MainUtil.sendMessage(player, Captions.CLUSTER_LIST_HEADING, clusters.size() + ""); for (PlotCluster cluster : clusters) { // Ignore unmanaged clusters String name = "'" + cluster.getName() + "' : " + cluster.toString(); if (player.getUUID().equals(cluster.owner)) { - MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&a" + name); + MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&a" + name); } else if (cluster.helpers.contains(player.getUUID())) { - MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&3" + name); + MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&3" + name); } else if (cluster.invited.contains(player.getUUID())) { - MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, "&9" + name); + MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&9" + name); } else { - MainUtil.sendMessage(player, C.CLUSTER_LIST_ELEMENT, cluster.toString()); + MainUtil + .sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, cluster.toString()); } } return true; } case "c": case "create": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_CREATE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_CREATE); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); return false; } if (args.length != 4) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster create "); return false; } @@ -82,7 +85,7 @@ import java.util.UUID; player.getClusterCount() : player.getPlotCount(player.getLocation().getWorld()); if (currentClusters >= player.getAllowedPlots()) { - return sendMessage(player, C.CANT_CLAIM_MORE_CLUSTERS); + return sendMessage(player, Captions.CANT_CLAIM_MORE_CLUSTERS); } PlotId pos1; PlotId pos2; @@ -91,13 +94,13 @@ import java.util.UUID; pos1 = PlotId.fromString(args[2]); pos2 = PlotId.fromString(args[3]); } catch (IllegalArgumentException ignored) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); return false; } // check if name is taken String name = args[1]; if (area.getCluster(name) != null) { - MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN); + MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN); return false; } if (pos2.x < pos1.x || pos2.y < pos1.y) { @@ -108,22 +111,23 @@ import java.util.UUID; //check if overlap PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2); if (cluster != null) { - MainUtil.sendMessage(player, C.CLUSTER_INTERSECTION, cluster.getName()); + MainUtil.sendMessage(player, Captions.CLUSTER_INTERSECTION, cluster.getName()); return false; } // Check if it occupies existing plots if (!area.contains(pos1) || !area.contains(pos2)) { - C.CLUSTER_OUTSIDE.send(player, area); + Captions.CLUSTER_OUTSIDE.send(player, area); return false; } Set plots = area.getPlotSelectionOwned(pos1, pos2); if (!plots.isEmpty()) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE_OTHER)) { + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE_OTHER)) { UUID uuid = player.getUUID(); for (Plot plot : plots) { if (!plot.isOwner(uuid)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER_CREATE_OTHER); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_CREATE_OTHER); return false; } } @@ -137,11 +141,12 @@ import java.util.UUID; } else { current = player.getPlayerClusterCount(player.getLocation().getWorld()); } - int allowed = Permissions.hasPermissionRange(player, C.PERMISSION_CLUSTER_SIZE, + int allowed = + Permissions.hasPermissionRange(player, Captions.PERMISSION_CLUSTER_SIZE, Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea())); return false; } // create cluster @@ -157,58 +162,62 @@ import java.util.UUID; } } } - MainUtil.sendMessage(player, C.CLUSTER_ADDED); + MainUtil.sendMessage(player, Captions.CLUSTER_ADDED); return true; } case "disband": case "del": case "delete": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_DELETE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_DELETE); return false; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster delete [name]"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot cluster delete [name]"); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); return false; } PlotCluster cluster; if (args.length == 2) { cluster = area.getCluster(args[1]); if (cluster == null) { - MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]); + MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]); return false; } } else { cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER); return false; } } if (!cluster.owner.equals(player.getUUID())) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE_OTHER)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER_DELETE_OTHER); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE_OTHER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_DELETE_OTHER); return false; } } DBFunc.delete(cluster); - MainUtil.sendMessage(player, C.CLUSTER_DELETED); + MainUtil.sendMessage(player, Captions.CLUSTER_DELETED); return true; } case "res": case "resize": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_RESIZE); return false; } if (args.length != 3) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster resize "); return false; } @@ -219,7 +228,7 @@ import java.util.UUID; pos1 = PlotId.fromString(args[2]); pos2 = PlotId.fromString(args[3]); } catch (IllegalArgumentException ignored) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); return false; } if (pos2.x < pos1.x || pos2.y < pos1.y) { @@ -229,25 +238,27 @@ import java.util.UUID; // check if in cluster PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); return false; } PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER); return false; } if (!cluster.hasHelperRights(player.getUUID())) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_OTHER)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER_RESIZE_OTHER); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_OTHER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_RESIZE_OTHER); return false; } } //check if overlap PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2); if (intersect != null) { - MainUtil.sendMessage(player, C.CLUSTER_INTERSECTION, intersect.getName()); + MainUtil + .sendMessage(player, Captions.CLUSTER_INTERSECTION, intersect.getName()); return false; } Set existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2()); @@ -258,17 +269,19 @@ import java.util.UUID; removed.removeAll(newPlots); // Check expand / shrink if (!removed.isEmpty()) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_SHRINK)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER_RESIZE_SHRINK); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_SHRINK)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_RESIZE_SHRINK); return false; } } newPlots.removeAll(existing); if (!newPlots.isEmpty()) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_EXPAND)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER_RESIZE_EXPAND); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_EXPAND)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_RESIZE_EXPAND); return false; } } @@ -280,50 +293,53 @@ import java.util.UUID; current = player.getPlayerClusterCount(player.getLocation().getWorld()); } current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); - int allowed = Permissions - .hasPermissionRange(player, C.PERMISSION_CLUSTER, Settings.Limit.MAX_PLOTS); + int allowed = Permissions.hasPermissionRange(player, Captions.PERMISSION_CLUSTER, + Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea())); return false; } // resize cluster DBFunc.resizeCluster(cluster, pos1, pos2); - MainUtil.sendMessage(player, C.CLUSTER_RESIZED); + MainUtil.sendMessage(player, Captions.CLUSTER_RESIZED); return true; } case "add": case "inv": case "invite": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INVITE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_INVITE); return false; } if (args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster invite "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot cluster invite "); return false; } // check if in cluster PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); } PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER); return false; } if (!cluster.hasHelperRights(player.getUUID())) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE_OTHER)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER_INVITE_OTHER); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE_OTHER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_INVITE_OTHER); return false; } } // check uuid UUID uuid = UUIDHandler.getUUID(args[1], null); if (uuid == null) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[2]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[2]); return false; } if (!cluster.isAdded(uuid)) { @@ -332,49 +348,52 @@ import java.util.UUID; DBFunc.setInvited(cluster, uuid); PlotPlayer player2 = UUIDHandler.getPlayer(uuid); if (player2 != null) { - MainUtil.sendMessage(player2, C.CLUSTER_INVITED, cluster.getName()); + MainUtil.sendMessage(player2, Captions.CLUSTER_INVITED, cluster.getName()); } } - MainUtil.sendMessage(player, C.CLUSTER_ADDED_USER); + MainUtil.sendMessage(player, Captions.CLUSTER_ADDED_USER); return true; } case "k": case "remove": case "kick": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_KICK); return false; } if (args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster kick "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot cluster kick "); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); } PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER); return false; } if (!cluster.hasHelperRights(player.getUUID())) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK_OTHER)) { - MainUtil - .sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK_OTHER); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLUSTER_KICK_OTHER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_KICK_OTHER); return false; } } // check uuid UUID uuid = UUIDHandler.getUUID(args[1], null); if (uuid == null) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[1]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[1]); return false; } // Can't kick if the player is yourself, the owner, or not added to the cluster if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner) || !cluster .isAdded(uuid)) { - MainUtil.sendMessage(player, C.CANNOT_KICK_PLAYER, cluster.getName()); + MainUtil.sendMessage(player, Captions.CANNOT_KICK_PLAYER, cluster.getName()); return false; } if (cluster.helpers.contains(uuid)) { @@ -385,7 +404,7 @@ import java.util.UUID; DBFunc.removeInvited(cluster, uuid); PlotPlayer player2 = UUIDHandler.getPlayer(uuid); if (player2 != null) { - MainUtil.sendMessage(player2, C.CLUSTER_REMOVED, cluster.getName()); + MainUtil.sendMessage(player2, Captions.CLUSTER_REMOVED, cluster.getName()); } for (Plot plot : new ArrayList<>( PlotSquared.get().getPlots(player2.getLocation().getWorld(), uuid))) { @@ -394,44 +413,46 @@ import java.util.UUID; plot.unclaim(); } } - MainUtil.sendMessage(player2, C.CLUSTER_KICKED_USER); + MainUtil.sendMessage(player2, Captions.CLUSTER_KICKED_USER); return true; } case "quit": case "leave": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LEAVE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LEAVE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LEAVE)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_LEAVE); return false; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster leave [name]"); + MainUtil + .sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster leave [name]"); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); } PlotCluster cluster; if (args.length == 2) { cluster = area.getCluster(args[1]); if (cluster == null) { - MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]); + MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]); return false; } } else { cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER); return false; } } UUID uuid = player.getUUID(); if (!cluster.isAdded(uuid)) { - MainUtil.sendMessage(player, C.CLUSTER_NOT_ADDED); + MainUtil.sendMessage(player, Captions.CLUSTER_NOT_ADDED); return false; } if (uuid.equals(cluster.owner)) { - MainUtil.sendMessage(player, C.CLUSTER_CANNOT_LEAVE); + MainUtil.sendMessage(player, Captions.CLUSTER_CANNOT_LEAVE); return false; } if (cluster.helpers.contains(uuid)) { @@ -440,7 +461,7 @@ import java.util.UUID; } cluster.invited.remove(uuid); DBFunc.removeInvited(cluster, uuid); - MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName()); + MainUtil.sendMessage(player, Captions.CLUSTER_REMOVED, cluster.getName()); for (Plot plot : new ArrayList<>( PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) { PlotCluster current = plot.getCluster(); @@ -455,102 +476,107 @@ import java.util.UUID; case "admin": case "helper": case "helpers": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_HELPERS)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_HELPERS); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_HELPERS)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_HELPERS); return false; } if (args.length != 3) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster helpers "); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); } PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER); return false; } UUID uuid = UUIDHandler.getUUID(args[2], null); if (uuid == null) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[2]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[2]); return false; } if (args[1].equalsIgnoreCase("add")) { cluster.helpers.add(uuid); DBFunc.setHelper(cluster, uuid); - return MainUtil.sendMessage(player, C.CLUSTER_ADDED_HELPER); + return MainUtil.sendMessage(player, Captions.CLUSTER_ADDED_HELPER); } if (args[1].equalsIgnoreCase("remove")) { cluster.helpers.remove(uuid); DBFunc.removeHelper(cluster, uuid); - return MainUtil.sendMessage(player, C.CLUSTER_REMOVED_HELPER); + return MainUtil.sendMessage(player, Captions.CLUSTER_REMOVED_HELPER); } - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster helpers "); return false; } case "spawn": case "home": case "tp": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_TP); return false; } if (args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster tp "); + MainUtil + .sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster tp "); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); return false; } PlotCluster cluster = area.getCluster(args[1]); if (cluster == null) { - MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]); + MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]); return false; } UUID uuid = player.getUUID(); if (!cluster.isAdded(uuid)) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP_OTHER)) { - MainUtil - .sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP_OTHER); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP_OTHER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_TP_OTHER); return false; } } player.teleport(cluster.getHome()); - return MainUtil.sendMessage(player, C.CLUSTER_TELEPORTING); + return MainUtil.sendMessage(player, Captions.CLUSTER_TELEPORTING); } case "i": case "info": case "show": case "information": { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INFO)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INFO); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INFO)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_INFO); return false; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster info [name]"); + MainUtil + .sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster info [name]"); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); } PlotCluster cluster; if (args.length == 2) { cluster = area.getCluster(args[1]); if (cluster == null) { - MainUtil.sendMessage(player, C.INVALID_CLUSTER, args[1]); + MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]); return false; } } else { cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER); return false; } } @@ -563,7 +589,7 @@ import java.util.UUID; String size = (cluster.getP2().x - cluster.getP1().x + 1) + "x" + ( cluster.getP2().y - cluster.getP1().y + 1); String rights = cluster.isAdded(player.getUUID()) + ""; - String message = C.CLUSTER_INFO.s(); + String message = Captions.CLUSTER_INFO.s(); message = message.replaceAll("%id%", id); message = message.replaceAll("%owner%", owner); message = message.replaceAll("%name%", name); @@ -575,27 +601,29 @@ import java.util.UUID; case "sh": case "setspawn": case "sethome": - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SETHOME); + if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_SETHOME); return false; } if (args.length != 1 && args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot cluster sethome"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster sethome"); return false; } PlotArea area = player.getApplicablePlotArea(); if (area == null) { - C.NOT_IN_PLOT_WORLD.send(player); + Captions.NOT_IN_PLOT_WORLD.send(player); } PlotCluster cluster = area.getCluster(player.getLocation()); if (cluster == null) { - MainUtil.sendMessage(player, C.NOT_IN_CLUSTER); + MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER); return false; } if (!cluster.hasHelperRights(player.getUUID())) { - if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME_OTHER)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_CLUSTER_SETHOME_OTHER); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME_OTHER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_CLUSTER_SETHOME_OTHER); return false; } } @@ -605,9 +633,9 @@ import java.util.UUID; cluster.settings.setPosition(blockloc); DBFunc.setPosition(cluster, relative.getX() + "," + relative.getY() + "," + relative.getZ()); - return MainUtil.sendMessage(player, C.POSITION_SET); + return MainUtil.sendMessage(player, Captions.POSITION_SET); } - MainUtil.sendMessage(player, C.CLUSTER_AVAILABLE_ARGS); + MainUtil.sendMessage(player, Captions.CLUSTER_AVAILABLE_ARGS); return false; } } 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 9755d7150..a4441658b 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; @@ -22,13 +22,13 @@ public class Comment extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { if (args.length < 2) { - sendMessage(player, C.COMMENT_SYNTAX, + sendMessage(player, Captions.COMMENT_SYNTAX, StringMan.join(CommentManager.inboxes.keySet(), "|")); return false; } CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase()); if (inbox == null) { - sendMessage(player, C.COMMENT_SYNTAX, + sendMessage(player, Captions.COMMENT_SYNTAX, StringMan.join(CommentManager.inboxes.keySet(), "|")); return false; } @@ -37,7 +37,7 @@ public class Comment extends SubCommand { try { id = PlotId.fromString(args[1]); } catch (IllegalArgumentException ignored) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); return false; } Plot plot = MainUtil.getPlotFromString(player, args[1], false); @@ -47,14 +47,14 @@ public class Comment extends SubCommand { plot = loc.getPlotAbs(); } else { if (args.length < 4) { - sendMessage(player, C.COMMENT_SYNTAX, + sendMessage(player, Captions.COMMENT_SYNTAX, StringMan.join(CommentManager.inboxes.keySet(), "|")); return false; } index = 2; } if (!inbox.canWrite(plot, player)) { - sendMessage(player, C.NO_PERM_INBOX, ""); + sendMessage(player, Captions.NO_PERM_INBOX, ""); return false; } String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " "); @@ -63,8 +63,8 @@ public class Comment extends SubCommand { System.currentTimeMillis()); boolean result = inbox.addComment(plot, comment); if (!result) { - sendMessage(player, C.NO_PLOT_INBOX, ""); - sendMessage(player, C.COMMENT_SYNTAX, + sendMessage(player, Captions.NO_PLOT_INBOX, ""); + sendMessage(player, Captions.COMMENT_SYNTAX, StringMan.join(CommentManager.inboxes.keySet(), "|")); return false; } @@ -74,7 +74,7 @@ public class Comment extends SubCommand { MainUtil.sendMessage(pp, "/plot comment " + StringMan.join(args, " ")); } } - sendMessage(player, C.COMMENT_ADDED); + sendMessage(player, Captions.COMMENT_ADDED); return true; } } 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 b33bd4dab..75a4709b8 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.CmdInstance; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -16,13 +16,13 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; @Override public boolean onCommand(PlotPlayer player, String[] args) { CmdInstance command = CmdConfirm.getPending(player); if (command == null) { - MainUtil.sendMessage(player, C.FAILED_CONFIRM); + MainUtil.sendMessage(player, Captions.FAILED_CONFIRM); return false; } CmdConfirm.removePending(player); if ((System.currentTimeMillis() - command.timestamp) > Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS * 1000) { - MainUtil.sendMessage(player, C.EXPIRED_CONFIRM); + MainUtil.sendMessage(player, Captions.EXPIRED_CONFIRM); return false; } TaskManager.runTask(command.command); 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 68bf8c786..4aec2d6d0 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -17,29 +17,30 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; @Override public boolean onCommand(PlotPlayer player, String[] args) { Plot plot = player.getCurrentPlot(); if ((plot == null) || !plot.hasOwner()) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CONTINUE)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CONTINUE)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } if (!plot.hasFlag(Flags.DONE)) { - MainUtil.sendMessage(player, C.DONE_NOT_DONE); + MainUtil.sendMessage(player, Captions.DONE_NOT_DONE); return false; } int size = plot.getConnectedPlots().size(); if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_ADMIN_COMMAND_CONTINUE); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_ADMIN_COMMAND_CONTINUE); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return false; } plot.removeFlag(Flags.DONE); - MainUtil.sendMessage(player, C.DONE_REMOVED); + MainUtil.sendMessage(player, Captions.DONE_REMOVED); return true; } } 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 8303ef042..f925720f1 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -16,15 +16,15 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; Location loc = player.getLocation(); Plot plot1 = loc.getPlotAbs(); if (plot1 == null) { - return !MainUtil.sendMessage(player, C.NOT_IN_PLOT); + return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN.s())) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } if (args.length != 1) { - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } Plot plot2 = MainUtil.getPlotFromString(player, args[0], true); @@ -32,22 +32,22 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; return false; } if (plot1.equals(plot2)) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); - C.COMMAND_SYNTAX.send(player, getUsage()); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } if (!plot1.getArea().isCompatible(plot2.getArea())) { - C.PLOTWORLD_INCOMPATIBLE.send(player); + Captions.PLOTWORLD_INCOMPATIBLE.send(player); return false; } if (plot1.copy(plot2, new Runnable() { @Override public void run() { - MainUtil.sendMessage(player, C.COPY_SUCCESS); + MainUtil.sendMessage(player, Captions.COPY_SUCCESS); } })) { return true; } else { - MainUtil.sendMessage(player, C.REQUIRES_UNOWNED); + MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED); return false; } } 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 acc47a64e..26962781c 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -19,10 +19,10 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; Location loc = player.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { - return sendMessage(player, C.NOT_IN_PLOT); + return sendMessage(player, Captions.NOT_IN_PLOT); } if (!(loc.getPlotArea() instanceof HybridPlotWorld)) { - return sendMessage(player, C.NOT_IN_PLOT_WORLD); + return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } HybridUtils.manager.setupRoadSchematic(plot); MainUtil.sendMessage(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 28594982c..527b67819 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.StringMan; @@ -14,23 +14,23 @@ public class Debug extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { StringBuilder msg = new StringBuilder(); - for (C caption : C.values()) { + for (Captions caption : Captions.values()) { msg.append(caption.s()).append("\n"); } MainUtil.sendMessage(player, msg.toString()); return true; } StringBuilder information = new StringBuilder(); - String header = C.DEBUG_HEADER.s(); - String line = C.DEBUG_LINE.s(); - String section = C.DEBUG_SECTION.s(); + String header = Captions.DEBUG_HEADER.s(); + String line = Captions.DEBUG_LINE.s(); + String section = Captions.DEBUG_SECTION.s(); information.append(header); information.append(getSection(section, "PlotArea")); information.append( getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", "))); information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size())); information.append(getSection(section, "Messages")); - information.append(getLine(line, "Total Messages", C.values().length)); + information.append(getLine(line, "Total Messages", Captions.values().length)); information.append(getLine(line, "View all captions", "/plot debug msg")); MainUtil.sendMessage(player, information.toString()); return true; 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 cbfacfae6..8413eae22 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import java.util.ArrayList; @@ -19,10 +19,10 @@ import java.util.UUID; if (unsafeAllowed.contains(player.getUUID())) { unsafeAllowed.remove(player.getUUID()); - sendMessage(player, C.DEBUGALLOWUNSAFE_OFF); + sendMessage(player, Captions.DEBUGALLOWUNSAFE_OFF); } else { unsafeAllowed.add(player.getUUID()); - sendMessage(player, C.DEBUGALLOWUNSAFE_ON); + sendMessage(player, Captions.DEBUGALLOWUNSAFE_ON); } return true; } 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 01a344369..9d5dc9d3d 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; @@ -29,7 +29,7 @@ public class DebugClaimTest extends SubCommand { } PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { - C.NOT_VALID_PLOT_WORLD.send(player, args[0]); + Captions.NOT_VALID_PLOT_WORLD.send(player, args[0]); return false; } PlotId min, max; 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 01cd1fefc..623b989ea 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.Flag; @@ -111,7 +111,7 @@ import java.util.*; this.scope.put("MainCommand", MainCommand.getInstance()); // enums - for (Enum value : C.values()) { + for (Enum value : Captions.values()) { this.scope.put("C_" + value.name(), value); } } @@ -129,7 +129,7 @@ import java.util.*; case "analyze": { Plot plot = player.getCurrentPlot(); if (plot == null) { - MainUtil.sendMessage(player, C.NOT_IN_PLOT); + MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return false; } PlotAnalysis analysis = plot.getComplexity(null); @@ -148,7 +148,7 @@ import java.util.*; } case "calibrate-analysis": if (args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot debugexec analyze "); MainUtil.sendMessage(player, "$1 $2= $1The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating " @@ -174,7 +174,7 @@ import java.util.*; return MainUtil.sendMessage(player, "Cancelled task."); case "remove-flag": if (args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot debugexec remove-flag "); return false; } @@ -194,7 +194,7 @@ import java.util.*; } PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]); if (area == null) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[1]); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[1]); return false; } boolean result; @@ -274,15 +274,15 @@ import java.util.*; DebugExec.this.engine.eval(cmd, DebugExec.this.scope); } catch (ScriptException e) { e.printStackTrace(); - MainUtil.sendMessage(player, C.COMMAND_WENT_WRONG); + MainUtil.sendMessage(player, Captions.COMMAND_WENT_WRONG); } } }; return true; } catch (IOException e) { e.printStackTrace(); - MainUtil - .sendMessage(player, C.COMMAND_SYNTAX, "/plot debugexec addcmd "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot debugexec addcmd "); return false; } case "runasync": @@ -322,7 +322,8 @@ import java.util.*; break; } default: - C.COMMAND_SYNTAX.send(player, "/plot debugexec list-scripts [#]"); + Captions.COMMAND_SYNTAX + .send(player, "/plot debugexec list-scripts [#]"); return false; } @@ -339,7 +340,7 @@ import java.util.*; return true; case "allcmd": if (args.length < 3) { - C.COMMAND_SYNTAX + Captions.COMMAND_SYNTAX .send(player, "/plot debugexec allcmd "); return false; } @@ -379,7 +380,8 @@ import java.util.*; break; case "all": if (args.length < 3) { - C.COMMAND_SYNTAX.send(player, "/plot debugexec all "); + Captions.COMMAND_SYNTAX + .send(player, "/plot debugexec all "); return false; } script = @@ -392,7 +394,7 @@ import java.util.*; script = StringMan.join(args, " "); } if (!(player instanceof ConsolePlayer)) { - MainUtil.sendMessage(player, C.NOT_CONSOLE); + MainUtil.sendMessage(player, Captions.NOT_CONSOLE); return false; } init(); 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 da1e27e61..ca848a6bb 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -28,7 +28,7 @@ public class DebugFixFlags extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[0]); return false; } MainUtil.sendMessage(player, "&8--- &6Starting task &8 ---"); 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 b191ac323..e442f596f 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.IncendoPaster; @@ -123,7 +123,8 @@ import java.util.stream.Collectors; final String pasteId = jsonObject.get("paste_id").getAsString(); final String link = String.format("https://incendo.org/paste/view/%s", pasteId); - player.sendMessage(C.DEBUG_REPORT_CREATED.s().replace("%url%", link)); + player + .sendMessage(Captions.DEBUG_REPORT_CREATED.s().replace("%url%", link)); } else { final String responseMessage = jsonObject.get("response").getAsString(); MainUtil.sendMessage(player, String 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 84489e88b..fd0b29657 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -20,13 +20,13 @@ public class DebugRoadRegen extends SubCommand { Location loc = player.getLocation(); PlotArea plotArea = loc.getPlotArea(); if (!(plotArea instanceof HybridPlotWorld)) { - return sendMessage(player, C.NOT_IN_PLOT_WORLD); + return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } Plot plot = player.getCurrentPlot(); if (plot == null) { - C.NOT_IN_PLOT.send(player); + Captions.NOT_IN_PLOT.send(player); } else if (plot.isMerged()) { - C.REQUIRES_UNMERGED.send(player); + Captions.REQUIRES_UNMERGED.send(player); } else { HybridPlotManager manager = (HybridPlotManager) plotArea.getPlotManager(); manager.createRoadEast(plotArea, plot); 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 fbbc3267c..0c544d096 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 @@ -16,14 +16,10 @@ import java.util.ArrayList; public class DebugSaveTest extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - ArrayList plots = new ArrayList(); - plots.addAll(PlotSquared.get().getPlots()); + ArrayList plots = new ArrayList<>(PlotSquared.get().getPlots()); MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`"); - DBFunc.createPlotsAndData(plots, new Runnable() { - @Override public void run() { - MainUtil.sendMessage(player, "&6Database sync finished!"); - } - }); + DBFunc.createPlotsAndData(plots, + () -> MainUtil.sendMessage(player, "&6Database sync finished!")); return true; } } 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 b399f5752..16f10b7b0 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.*; @@ -19,14 +19,14 @@ import com.github.intellectualsites.plotsquared.plot.util.*; Location loc = player.getLocation(); final Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - return !sendMessage(player, C.PLOT_UNOWNED); + return !sendMessage(player, Captions.PLOT_UNOWNED); } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DELETE)) { - return !sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DELETE)) { + return !sendMessage(player, Captions.NO_PLOT_PERMS); } final PlotArea plotArea = plot.getArea(); final java.util.Set plots = plot.getConnectedPlots(); @@ -35,7 +35,7 @@ import com.github.intellectualsites.plotsquared.plot.util.*; Runnable run = new Runnable() { @Override public void run() { if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return; } final long start = System.currentTimeMillis(); @@ -47,17 +47,17 @@ import com.github.intellectualsites.plotsquared.plot.util.*; double value = plots.size() * valueExr.evaluate((double) currentPlots); if (value > 0d) { EconHandler.manager.depositMoney(player, value); - sendMessage(player, C.ADDED_BALANCE, String.valueOf(value)); + sendMessage(player, Captions.ADDED_BALANCE, String.valueOf(value)); } } - MainUtil.sendMessage(player, C.DELETING_DONE, + MainUtil.sendMessage(player, Captions.DELETING_DONE, System.currentTimeMillis() - start); } }); if (result) { plot.addRunning(); } else { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); } } }; 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 e586f0656..fe917e08a 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -28,38 +28,38 @@ import java.util.UUID; Location location = player.getLocation(); Plot plot = location.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return true; } Set uuids = MainUtil.getUUIDsFromString(args[0]); if (uuids.isEmpty()) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); return false; } Iterator iter = uuids.iterator(); while (iter.hasNext()) { UUID uuid = iter.next(); if (uuid == DBFunc.EVERYONE && !( - Permissions.hasPermission(player, C.PERMISSION_DENY_EVERYONE) || Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY))) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); + Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) { + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid)); continue; } if (plot.isOwner(uuid)) { - MainUtil.sendMessage(player, C.ALREADY_OWNER, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid)); return false; } if (plot.getDenied().contains(uuid)) { - MainUtil.sendMessage(player, C.ALREADY_ADDED, MainUtil.getName(uuid)); + MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid)); return false; } if (uuid != DBFunc.EVERYONE) { @@ -77,7 +77,7 @@ import java.util.UUID; } } if (!uuids.isEmpty()) { - MainUtil.sendMessage(player, C.DENIED_ADDED); + MainUtil.sendMessage(player, Captions.DENIED_ADDED); } return true; } @@ -97,13 +97,13 @@ import java.util.UUID; } Location loc = player.getLocation(); Location spawn = WorldUtil.IMP.getSpawn(loc.getWorld()); - MainUtil.sendMessage(player, C.YOU_GOT_DENIED); + MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED); if (plot.equals(spawn.getPlot())) { Location newSpawn = WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn - player.kick(C.YOU_GOT_DENIED.s()); + player.kick(Captions.YOU_GOT_DENIED.s()); } else { player.teleport(newSpawn); } 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 687eef002..ec62e299c 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -16,15 +16,15 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @Override public boolean set(PlotPlayer player, Plot plot, String desc) { if (desc.isEmpty()) { plot.removeFlag(Flags.DESCRIPTION); - MainUtil.sendMessage(player, C.DESC_UNSET); + MainUtil.sendMessage(player, Captions.DESC_UNSET); return true; } boolean result = FlagManager.addPlotFlag(plot, Flags.DESCRIPTION, desc); if (!result) { - MainUtil.sendMessage(player, C.FLAG_NOT_ADDED); + MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); return false; } - MainUtil.sendMessage(player, C.DESC_SET); + MainUtil.sendMessage(player, Captions.DESC_SET); return true; } } 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 a37c187cc..8ef920565 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; @@ -22,23 +22,23 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; Location loc = player.getLocation(); final Plot plot = loc.getPlotAbs(); if ((plot == null) || !plot.hasOwner()) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DONE)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DONE)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } if (plot.hasFlag(Flags.DONE)) { - MainUtil.sendMessage(player, C.DONE_ALREADY_DONE); + MainUtil.sendMessage(player, Captions.DONE_ALREADY_DONE); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return false; } plot.addRunning(); - MainUtil.sendMessage(player, C.GENERATING_LINK); + MainUtil.sendMessage(player, Captions.GENERATING_LINK); final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done"); if (ExpireManager.IMP == null || doneRequirements == null) { finish(plot, player, true); @@ -60,9 +60,9 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; if (success) { long flagValue = System.currentTimeMillis() / 1000; plot.setFlag(Flags.DONE, flagValue); - MainUtil.sendMessage(pp, C.DONE_SUCCESS); + MainUtil.sendMessage(pp, Captions.DONE_SUCCESS); } else { - MainUtil.sendMessage(pp, C.DONE_INSUFFICIENT_COMPLEXITY); + MainUtil.sendMessage(pp, Captions.DONE_INSUFFICIENT_COMPLEXITY); } } } 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 7dd7b7acd..43560b81f 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -21,34 +21,34 @@ import java.net.URL; @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); if (!PlotSquared.get().hasPlotArea(world)) { - return !sendMessage(player, C.NOT_IN_PLOT_WORLD); + return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } final Plot plot = player.getCurrentPlot(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent())) - && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) { - MainUtil.sendMessage(player, C.DONE_NOT_DONE); + && !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) { + MainUtil.sendMessage(player, Captions.DONE_NOT_DONE); return false; } if ((!plot.isOwner(player.getUUID())) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN.s())) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return false; } if (args.length == 0 || (args.length == 1 && StringMan .isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) { if (plot.getVolume() > Integer.MAX_VALUE) { - C.SCHEMATIC_TOO_LARGE.send(player); + Captions.SCHEMATIC_TOO_LARGE.send(player); return false; } plot.addRunning(); @@ -58,7 +58,7 @@ import java.net.URL; SchematicHandler.manager.upload(value, null, null, new RunnableVal() { @Override public void run(URL url) { if (url == null) { - MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED); + MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED); return; } MainUtil.sendMessage(player, url.toString()); @@ -68,8 +68,8 @@ import java.net.URL; }); } else if (args.length == 1 && StringMan .isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) { - if (!Permissions.hasPermission(player, C.PERMISSION_DOWNLOAD_WORLD)) { - C.NO_PERMISSION.send(player, C.PERMISSION_DOWNLOAD_WORLD); + if (!Permissions.hasPermission(player, Captions.PERMISSION_DOWNLOAD_WORLD)) { + Captions.NO_PERMISSION.send(player, Captions.PERMISSION_DOWNLOAD_WORLD); return false; } MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512"); @@ -79,17 +79,17 @@ import java.net.URL; @Override public void run(URL url) { plot.removeRunning(); if (url == null) { - MainUtil.sendMessage(player, C.GENERATING_LINK_FAILED); + MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED); return; } MainUtil.sendMessage(player, url.toString()); } }); } else { - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } - MainUtil.sendMessage(player, C.GENERATING_LINK); + MainUtil.sendMessage(player, Captions.GENERATING_LINK); return true; } } 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 9d0435c07..a732df9a7 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.*; @@ -22,7 +22,8 @@ import java.util.*; private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) { key = key.toLowerCase(); value = value.toLowerCase(); - String perm = C.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()); + String perm = + Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()); if (flag instanceof IntegerFlag && MathMan.isInteger(value)) { try { int numeric = Integer.parseInt(value); @@ -33,8 +34,8 @@ import java.util.*; Settings.Limit.MAX_PLOTS; final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric; if (!result) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_SET_FLAG_KEY_VALUE + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_SET_FLAG_KEY_VALUE .f(key.toLowerCase(), value.toLowerCase())); } return result; @@ -46,12 +47,13 @@ import java.util.*; final PlotBlockListFlag blockListFlag = (PlotBlockListFlag) flag; final HashSet parsedBlocks = blockListFlag.parseValue(value); for (final PlotBlock block : parsedBlocks) { - final String permission = C.PERMISSION_SET_FLAG_KEY_VALUE + final String permission = Captions.PERMISSION_SET_FLAG_KEY_VALUE .f(key.toLowerCase(), block.getRawId().toString().toLowerCase()); final boolean result = Permissions.hasPermission(player, permission); if (!result) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_SET_FLAG_KEY_VALUE + .f(key.toLowerCase(), value.toLowerCase())); return false; } } @@ -59,8 +61,8 @@ import java.util.*; } final boolean result = Permissions.hasPermission(player, perm); if (!result) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase())); } return result; } @@ -75,22 +77,24 @@ import java.util.*; * plot flag list */ if (args.length == 0) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot flag "); return false; } Location loc = player.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { - MainUtil.sendMessage(player, C.NOT_IN_PLOT); + MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return false; } if (!plot.hasOwner()) { - sendMessage(player, C.PLOT_NOT_CLAIMED); + sendMessage(player, Captions.PLOT_NOT_CLAIMED); return false; } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_SET_FLAG_OTHER)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_OTHER); + .hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER); return false; } Flag flag = null; @@ -103,41 +107,43 @@ import java.util.*; new StringComparison<>(args[1], Flags.getFlags()); String best = stringComparison.getBestMatch(); if (best != null) { - MainUtil.sendMessage(player, C.NOT_VALID_FLAG_SUGGESTED, best); + MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG_SUGGESTED, best); suggested = true; } } catch (final Exception ignored) { /* Happens sometimes because of mean code */ } if (!suggested) { - MainUtil.sendMessage(player, C.NOT_VALID_FLAG); + MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG); } return false; } } switch (args[0].toLowerCase()) { case "info": { - if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.info"); + if (!Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.flag.info"); return false; } if (args.length != 2) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag info "); return false; } // flag key - MainUtil.sendMessage(player, C.FLAG_KEY, flag.getName()); + MainUtil.sendMessage(player, Captions.FLAG_KEY, flag.getName()); // flag type - MainUtil.sendMessage(player, C.FLAG_TYPE, flag.getClass().getSimpleName()); + MainUtil.sendMessage(player, Captions.FLAG_TYPE, flag.getClass().getSimpleName()); // Flag type description - MainUtil.sendMessage(player, C.FLAG_DESC, flag.getValueDescription()); + MainUtil.sendMessage(player, Captions.FLAG_DESC, flag.getValueDescription()); return true; } case "set": { - if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG); + if (!Permissions.hasPermission(player, Captions.PERMISSION_SET_FLAG)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG); return false; } if (args.length < 3) { - MainUtil.sendMessage(player, C.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), " "); @@ -151,27 +157,28 @@ import java.util.*; } boolean result = plot.setFlag(flag, parsed); if (!result) { - MainUtil.sendMessage(player, C.FLAG_NOT_ADDED); + MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); return false; } - MainUtil.sendMessage(player, C.FLAG_ADDED); + MainUtil.sendMessage(player, Captions.FLAG_ADDED); return true; } case "remove": { - if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_REMOVE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_REMOVE); + if (!Permissions.hasPermission(player, 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, C.COMMAND_SYNTAX, "/plot flag remove [values]"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot flag remove [values]"); return false; } - if (!Permissions - .hasPermission(player, C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) { + if (!Permissions.hasPermission(player, + Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) { if (args.length != 3) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase())); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase())); return false; } for (String entry : args[2].split(",")) { @@ -190,16 +197,16 @@ import java.util.*; if (flag1.get().isEmpty()) { final boolean result = plot.removeFlag(flag); if (result) { - MainUtil.sendMessage(player, C.FLAG_REMOVED); + MainUtil.sendMessage(player, Captions.FLAG_REMOVED); } else { - MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED); + MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); } return true; } else { - MainUtil.sendMessage(player, C.FLAG_REMOVED); + MainUtil.sendMessage(player, Captions.FLAG_REMOVED); } } else { - MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED); + MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); return false; } } @@ -208,7 +215,7 @@ import java.util.*; } else { boolean result = plot.removeFlag(flag); if (!result) { - MainUtil.sendMessage(player, C.FLAG_NOT_REMOVED); + MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); return false; } } @@ -217,17 +224,18 @@ import java.util.*; } else if (flag == Flags.WEATHER) { player.setWeather(PlotWeather.RESET); } - MainUtil.sendMessage(player, C.FLAG_REMOVED); + MainUtil.sendMessage(player, Captions.FLAG_REMOVED); return true; } case "add": - if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_ADD)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_ADD); + if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_ADD)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_ADD); return false; } if (args.length < 3) { - MainUtil - .sendMessage(player, C.COMMAND_SYNTAX, "/plot flag add "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot flag add "); return false; } for (String entry : args[2].split(",")) { @@ -248,28 +256,29 @@ import java.util.*; if (flag1.isPresent()) { boolean o = flag1.get().addAll((Collection) parsed); if (o) { - MainUtil.sendMessage(player, C.FLAG_ADDED); + MainUtil.sendMessage(player, Captions.FLAG_ADDED); val = flag1.get(); } else { - MainUtil.sendMessage(player, C.FLAG_NOT_ADDED); + MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); return false; } } } boolean result = plot.setFlag(flag, val); if (!result) { - MainUtil.sendMessage(player, C.FLAG_NOT_ADDED); + MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); return false; } - MainUtil.sendMessage(player, C.FLAG_ADDED); + MainUtil.sendMessage(player, Captions.FLAG_ADDED); return true; case "list": - if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_LIST)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_LIST); + if (!Permissions.hasPermission(player, Captions.PERMISSION_FLAG_LIST)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_FLAG_LIST); return false; } if (args.length > 1) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag list"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag list"); return false; } HashMap> flags = new HashMap<>(); @@ -293,7 +302,8 @@ import java.util.*; MainUtil.sendMessage(player, message.toString()); return true; } - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag "); + MainUtil + .sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag "); return false; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java index 5a69479b5..83161d73a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/GenerateDocs.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.io.File; @@ -142,7 +142,7 @@ public class GenerateDocs { Matcher m2 = p2.matcher(line); while (m2.find()) { - perms.add(C.valueOf("PERMISSION_" + m2.group(1)).s()); + perms.add(Captions.valueOf("PERMISSION_" + m2.group(1)).s()); } if (line.contains("Permissions.hasPermission(")) { String[] split = line.split("Permissions.hasPermission"); @@ -151,7 +151,7 @@ public class GenerateDocs { String perm = method.split("[,|)]")[1].trim(); if (!perm.equalsIgnoreCase(perm)) { if (perm.startsWith("C.")) { - perm = C.valueOf(perm.split("\\.")[1]).s(); + perm = Captions.valueOf(perm.split("\\.")[1]).s(); } else { continue; } @@ -181,7 +181,7 @@ public class GenerateDocs { String perm = method.split("[,|)]")[1].trim(); if (!perm.equalsIgnoreCase(perm)) { if (perm.startsWith("C.")) { - perm = C.valueOf(perm.split("\\.")[1]).s(); + perm = Captions.valueOf(perm.split("\\.")[1]).s(); } else { continue; } 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 d29bd76bb..ed3cc9856 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -26,13 +26,13 @@ import java.util.UUID; @Override public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - checkTrue(args.length >= 1 && args.length <= 2, C.COMMAND_SYNTAX, getUsage()); + checkTrue(args.length >= 1 && args.length <= 2, Captions.COMMAND_SYNTAX, getUsage()); final String arg0 = args[0].toLowerCase(); switch (arg0) { case "add": case "check": - if (!Permissions.hasPermission(player, C.PERMISSION_GRANT.f(arg0))) { - C.NO_PERMISSION.send(player, C.PERMISSION_GRANT.f(arg0)); + if (!Permissions.hasPermission(player, Captions.PERMISSION_GRANT.f(arg0))) { + Captions.NO_PERMISSION.send(player, Captions.PERMISSION_GRANT.f(arg0)); return; } if (args.length > 2) { @@ -41,7 +41,7 @@ import java.util.UUID; final UUID uuid = args.length == 2 ? UUIDHandler.getUUIDFromString(args[1]) : player.getUUID(); if (uuid == null) { - C.INVALID_PLAYER.send(player, args[1]); + Captions.INVALID_PLAYER.send(player, args[1]); return; } MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal() { @@ -49,7 +49,7 @@ import java.util.UUID; if (arg0.equals("check")) { // check int granted = array == null ? 0 : ByteArrayUtilities.bytesToInteger(array); - C.GRANTED_PLOTS.send(player, granted); + Captions.GRANTED_PLOTS.send(player, granted); } else { // add int amount = 1 + (array == null ? 0 : ByteArrayUtilities.bytesToInteger(array)); @@ -66,6 +66,6 @@ import java.util.UUID; } }); } - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); } } 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 f0ff64af1..674ba4fe9 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; @@ -50,7 +50,7 @@ public class Help extends Command { } return; default: - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); } } @@ -74,15 +74,16 @@ public class Help extends Command { } if (cat == null && page == 0) { StringBuilder builder = new StringBuilder(); - builder.append(C.HELP_HEADER.s()); + builder.append(Captions.HELP_HEADER.s()); for (CommandCategory c : CommandCategory.values()) { builder.append("\n" + StringMan - .replaceAll(C.HELP_INFO_ITEM.s(), "%category%", c.toString().toLowerCase(), + .replaceAll(Captions.HELP_INFO_ITEM.s(), "%category%", + c.toString().toLowerCase(), "%category_desc%", c.toString())); } - builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", "all") + builder.append("\n").append(Captions.HELP_INFO_ITEM.s().replaceAll("%category%", "all") .replaceAll("%category_desc%", "Display all commands")); - builder.append("\n" + C.HELP_FOOTER.s()); + builder.append("\n" + Captions.HELP_FOOTER.s()); MainUtil.sendMessage(player, builder.toString(), false); return; } 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 b8ffd4261..259395b5a 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; @@ -20,7 +20,7 @@ import java.util.List; public void displayComments(PlotPlayer player, List oldComments, int page) { if (oldComments == null || oldComments.isEmpty()) { - MainUtil.sendMessage(player, C.INBOX_EMPTY); + MainUtil.sendMessage(player, Captions.INBOX_EMPTY); return; } PlotComment[] comments = oldComments.toArray(new PlotComment[oldComments.size()]); @@ -40,7 +40,7 @@ import java.util.List; } StringBuilder string = new StringBuilder(); string.append(StringMan - .replaceAll(C.COMMENT_LIST_HEADER_PAGED.s(), "%amount%", comments.length, "%cur", + .replaceAll(Captions.COMMENT_LIST_HEADER_PAGED.s(), "%amount%", comments.length, "%cur", page + 1, "%max", totalPages + 1, "%word", "all") + '\n'); // This might work xD @@ -62,15 +62,15 @@ import java.util.List; @Override public boolean onCommand(final PlotPlayer player, String[] args) { final Plot plot = player.getCurrentPlot(); if (plot == null) { - sendMessage(player, C.NOT_IN_PLOT); + sendMessage(player, Captions.NOT_IN_PLOT); return false; } if (!plot.hasOwner()) { - sendMessage(player, C.PLOT_UNOWNED); + sendMessage(player, Captions.PLOT_UNOWNED); return false; } if (args.length == 0) { - sendMessage(player, C.COMMAND_SYNTAX, + sendMessage(player, Captions.COMMAND_SYNTAX, "/plot inbox [inbox] [delete |clear|page]"); for (final CommentInbox inbox : CommentManager.inboxes.values()) { if (inbox.canRead(plot, player)) { @@ -93,16 +93,16 @@ import java.util.List; } else { color = ""; } - sendMessage(player, C.INBOX_ITEM, + sendMessage(player, Captions.INBOX_ITEM, color + inbox.toString() + " (" + total + '/' + unread + ')'); return; } } - sendMessage(player, C.INBOX_ITEM, inbox.toString()); + sendMessage(player, Captions.INBOX_ITEM, inbox.toString()); } })) { - sendMessage(player, C.INBOX_ITEM, inbox.toString()); + sendMessage(player, Captions.INBOX_ITEM, inbox.toString()); } } } @@ -110,7 +110,7 @@ import java.util.List; } final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase()); if (inbox == null) { - sendMessage(player, C.INVALID_INBOX, + sendMessage(player, Captions.INVALID_INBOX, StringMan.join(CommentManager.inboxes.keySet(), ", ")); return false; } @@ -120,22 +120,22 @@ import java.util.List; switch (args[1].toLowerCase()) { case "delete": if (!inbox.canModify(plot, player)) { - sendMessage(player, C.NO_PERM_INBOX_MODIFY); + sendMessage(player, Captions.NO_PERM_INBOX_MODIFY); return false; } if (args.length != 3) { - sendMessage(player, C.COMMAND_SYNTAX, + sendMessage(player, Captions.COMMAND_SYNTAX, "/plot inbox " + inbox.toString() + " delete "); } final int index; try { index = Integer.parseInt(args[2]); if (index < 1) { - sendMessage(player, C.NOT_VALID_INBOX_INDEX, index + ""); + sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + ""); return false; } } catch (NumberFormatException ignored) { - sendMessage(player, C.COMMAND_SYNTAX, + sendMessage(player, Captions.COMMAND_SYNTAX, "/plot inbox " + inbox.toString() + " delete "); return false; } @@ -143,35 +143,35 @@ import java.util.List; if (!inbox.getComments(plot, new RunnableVal>() { @Override public void run(List value) { if (index > value.size()) { - sendMessage(player, C.NOT_VALID_INBOX_INDEX, index + ""); + sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + ""); return; } PlotComment comment = value.get(index - 1); inbox.removeComment(plot, comment); plot.removeComment(comment); - MainUtil.sendMessage(player, C.COMMENT_REMOVED, comment.comment); + MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, comment.comment); } })) { - sendMessage(player, C.NOT_IN_PLOT); + sendMessage(player, Captions.NOT_IN_PLOT); return false; } return true; case "clear": if (!inbox.canModify(plot, player)) { - sendMessage(player, C.NO_PERM_INBOX_MODIFY); + sendMessage(player, Captions.NO_PERM_INBOX_MODIFY); } inbox.clearInbox(plot); List comments = plot.getComments(inbox.toString()); if (!comments.isEmpty()) { plot.removeComments(comments); } - MainUtil.sendMessage(player, C.COMMENT_REMOVED, "*"); + MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, "*"); return true; default: try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { - sendMessage(player, C.COMMAND_SYNTAX, + sendMessage(player, Captions.COMMAND_SYNTAX, "/plot inbox [inbox] [delete |clear|page]"); return false; } @@ -180,7 +180,7 @@ import java.util.List; page = 1; } if (!inbox.canRead(plot, player)) { - sendMessage(player, C.NO_PERM_INBOX); + sendMessage(player, Captions.NO_PERM_INBOX); return false; } if (!inbox.getComments(plot, new RunnableVal>() { @@ -188,7 +188,7 @@ import java.util.List; displayComments(player, value, page); } })) { - sendMessage(player, C.PLOT_UNOWNED); + sendMessage(player, Captions.PLOT_UNOWNED); return false; } return true; 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 6241e1d51..09f3e9c8b 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -50,7 +50,7 @@ import java.util.UUID; plot = player.getCurrentPlot(); } if (plot == null) { - MainUtil.sendMessage(player, C.NOT_IN_PLOT.s()); + MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.s()); return false; } if (arg != null) { @@ -97,11 +97,11 @@ import java.util.UUID; boolean trustedEveryone = plot.getMembers().contains(DBFunc.EVERYONE); // Unclaimed? if (!hasOwner && !containsEveryone && !trustedEveryone) { - MainUtil - .sendMessage(player, C.PLOT_INFO_UNCLAIMED, plot.getId().x + ";" + plot.getId().y); + MainUtil.sendMessage(player, Captions.PLOT_INFO_UNCLAIMED, + plot.getId().x + ";" + plot.getId().y); return true; } - String info = C.PLOT_INFO.s(); + String info = Captions.PLOT_INFO.s(); boolean full; if (arg != null) { info = getCaption(arg); @@ -118,7 +118,8 @@ import java.util.UUID; MainUtil.format(info, plot, player, full, new RunnableVal() { @Override public void run(String value) { MainUtil.sendMessage(player, - C.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + C.PLOT_INFO_FOOTER.s(), false); + Captions.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER + .s(), false); } }); return true; @@ -127,27 +128,27 @@ import java.util.UUID; private String getCaption(String string) { switch (string) { case "trusted": - return C.PLOT_INFO_TRUSTED.s(); + return Captions.PLOT_INFO_TRUSTED.s(); case "alias": - return C.PLOT_INFO_ALIAS.s(); + return Captions.PLOT_INFO_ALIAS.s(); case "biome": - return C.PLOT_INFO_BIOME.s(); + return Captions.PLOT_INFO_BIOME.s(); case "denied": - return C.PLOT_INFO_DENIED.s(); + return Captions.PLOT_INFO_DENIED.s(); case "flags": - return C.PLOT_INFO_FLAGS.s(); + return Captions.PLOT_INFO_FLAGS.s(); case "id": - return C.PLOT_INFO_ID.s(); + return Captions.PLOT_INFO_ID.s(); case "size": - return C.PLOT_INFO_SIZE.s(); + return Captions.PLOT_INFO_SIZE.s(); case "members": - return C.PLOT_INFO_MEMBERS.s(); + return Captions.PLOT_INFO_MEMBERS.s(); case "owner": - return C.PLOT_INFO_OWNER.s(); + return Captions.PLOT_INFO_OWNER.s(); case "rating": - return C.PLOT_INFO_RATING.s(); + return Captions.PLOT_INFO_RATING.s(); case "seen": - return C.PLOT_INFO_SEEN.s(); + return Captions.PLOT_INFO_SEEN.s(); default: return null; } 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 fc16db715..88e69f556 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -29,16 +29,16 @@ import java.util.UUID; Location location = player.getLocation(); Plot plot = location.getPlot(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_KICK)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_KICK)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } Set uuids = MainUtil.getUUIDsFromString(args[0]); if (uuids.isEmpty()) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); return false; } Set players = new HashSet<>(); @@ -46,7 +46,7 @@ import java.util.UUID; if (uuid == DBFunc.EVERYONE) { for (PlotPlayer pp : plot.getPlayersInPlot()) { if (pp == player || Permissions - .hasPermission(pp, C.PERMISSION_ADMIN_ENTRY_DENIED)) { + .hasPermission(pp, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) { continue; } players.add(pp); @@ -60,26 +60,26 @@ import java.util.UUID; } players.remove(player); // Don't ever kick the calling player if (players.isEmpty()) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); return false; } for (PlotPlayer player2 : players) { if (!plot.equals(player2.getCurrentPlot())) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); return false; } - if (Permissions.hasPermission(player2, C.PERMISSION_ADMIN_ENTRY_DENIED)) { - C.CANNOT_KICK_PLAYER.send(player, player2.getName()); + if (Permissions.hasPermission(player2, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) { + Captions.CANNOT_KICK_PLAYER.send(player, player2.getName()); return false; } Location spawn = WorldUtil.IMP.getSpawn(location.getWorld()); - C.YOU_GOT_KICKED.send(player2); + Captions.YOU_GOT_KICKED.send(player2); if (plot.equals(spawn.getPlot())) { Location newSpawn = WorldUtil.IMP .getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn - player2.kick(C.YOU_GOT_KICKED.s()); + player2.kick(Captions.YOU_GOT_KICKED.s()); } else { player2.plotkick(newSpawn); } 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 5504ce777..be29265bf 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; @@ -23,12 +23,12 @@ import java.util.UUID; @Override public void execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); - checkTrue(plot.hasOwner(), C.PLOT_UNOWNED); - checkTrue(plot.isAdded(player.getUUID()), C.NO_PLOT_PERMS); - checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage()); + final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); + checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED); + checkTrue(plot.isAdded(player.getUUID()), Captions.NO_PLOT_PERMS); + checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage()); if (plot.isOwner(player.getUUID())) { - checkTrue(plot.hasOwner(), C.ALREADY_OWNER); + checkTrue(plot.hasOwner(), Captions.ALREADY_OWNER); // TODO setowner, other } else { UUID uuid = player.getUUID(); @@ -39,9 +39,9 @@ import java.util.UUID; if (plot.removeMember(uuid)) { EventUtil.manager.callMember(player, plot, uuid, false); } - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); } else { - MainUtil.sendMessage(player, C.REMOVED_PLAYERS, 1); + MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, 1); } } } 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 c4b095f8d..725e4ed2b 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.*; @@ -20,43 +20,43 @@ public class ListCmd extends SubCommand { private String[] getArgumentList(PlotPlayer player) { List args = new ArrayList<>(); if (EconHandler.manager != null && Permissions - .hasPermission(player, C.PERMISSION_LIST_FORSALE)) { + .hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) { args.add("forsale"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) { args.add("mine"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) { args.add("shared"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) { args.add("world"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) { args.add("top"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) { args.add("all"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) { args.add("unowned"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNKNOWN)) { args.add("unknown"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) { args.add(""); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) { args.add(""); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) { args.add("done"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) { args.add("expired"); } - if (Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) { + if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) { args.add("fuzzy "); } return args.toArray(new String[args.size()]); @@ -64,7 +64,7 @@ public class ListCmd extends SubCommand { public void noArgs(PlotPlayer player) { MainUtil.sendMessage(player, - C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(player))); + Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(player))); } @Override public boolean onCommand(PlotPlayer player, String[] args) { @@ -93,16 +93,18 @@ public class ListCmd extends SubCommand { boolean sort = true; switch (arg) { case "mine": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_MINE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_MINE); return false; } sort = false; plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getBasePlots(player)); break; case "shared": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_SHARED); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_SHARED)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_SHARED); return false; } plots = new ArrayList<>(); @@ -114,20 +116,23 @@ public class ListCmd extends SubCommand { } break; case "world": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_WORLD); return false; } - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_LIST_WORLD_NAME.f(world)); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_WORLD_NAME.f(world)); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots(world)); break; case "expired": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_EXPIRED); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_EXPIRED)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_EXPIRED); return false; } plots = ExpireManager.IMP == null ? @@ -135,27 +140,31 @@ public class ListCmd extends SubCommand { new ArrayList<>(ExpireManager.IMP.getPendingExpired()); break; case "area": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_AREA)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_AREA); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_AREA)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_AREA); return false; } - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_LIST_WORLD_NAME.f(world)); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_WORLD_NAME.f(world)); return false; } plots = area == null ? new ArrayList() : new ArrayList<>(area.getPlots()); break; case "all": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_ALL)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_ALL); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots()); break; case "done": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_DONE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_DONE)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_DONE); return false; } plots = new ArrayList<>(); @@ -179,8 +188,9 @@ public class ListCmd extends SubCommand { sort = false; break; case "top": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) { + MainUtil + .sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_LIST_TOP); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots()); @@ -212,8 +222,9 @@ public class ListCmd extends SubCommand { sort = false; break; case "forsale": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FORSALE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FORSALE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_FORSALE); return false; } if (EconHandler.manager == null) { @@ -228,8 +239,9 @@ public class ListCmd extends SubCommand { } break; case "unowned": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNOWNED); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNOWNED)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_UNOWNED); return false; } plots = new ArrayList<>(); @@ -240,8 +252,9 @@ public class ListCmd extends SubCommand { } break; case "unknown": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNKNOWN); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_UNKNOWN)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_UNKNOWN); return false; } plots = new ArrayList<>(); @@ -255,12 +268,13 @@ public class ListCmd extends SubCommand { } break; case "fuzzy": - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FUZZY); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FUZZY)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_FUZZY); return false; } if (args.length < (page == -1 ? 2 : 3)) { - C.COMMAND_SYNTAX.send(player, "/plot list fuzzy [#]"); + Captions.COMMAND_SYNTAX.send(player, "/plot list fuzzy [#]"); return false; } String term; @@ -274,14 +288,15 @@ public class ListCmd extends SubCommand { break; default: if (PlotSquared.get().hasPlotArea(args[0])) { - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_WORLD); return false; } if (!Permissions - .hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(args[0]))) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_LIST_WORLD_NAME.f(args[0])); + .hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_WORLD_NAME.f(args[0])); return false; } plots = new ArrayList<>(PlotSquared.get().getPlots(args[0])); @@ -295,8 +310,9 @@ public class ListCmd extends SubCommand { } } if (uuid != null) { - if (!Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_PLAYER); + if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_PLAYER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_LIST_PLAYER); return false; } sort = false; @@ -306,14 +322,14 @@ public class ListCmd extends SubCommand { } if (plots == null) { - sendMessage(player, C.DID_YOU_MEAN, + sendMessage(player, Captions.DID_YOU_MEAN, new StringComparison<>(args[0], new String[] {"mine", "shared", "world", "all"}) .getBestMatch()); return false; } if (plots.isEmpty()) { - MainUtil.sendMessage(player, C.FOUND_NO_PLOTS); + MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS); return false; } displayPlots(player, plots, 12, page, area, args, sort); @@ -347,18 +363,20 @@ public class ListCmd extends SubCommand { } else { color = "$1"; } - PlotMessage trusted = new PlotMessage().text(C.color(C.PLOT_INFO_TRUSTED.s() + PlotMessage trusted = + new PlotMessage().text(Captions.color(Captions.PLOT_INFO_TRUSTED.s() .replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted())))) .color("$1"); - PlotMessage members = new PlotMessage().text(C.color(C.PLOT_INFO_MEMBERS.s() + PlotMessage members = + new PlotMessage().text(Captions.color(Captions.PLOT_INFO_MEMBERS.s() .replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers())))) .color("$1"); String strFlags = StringMan.join(plot.getFlags().values(), ","); if (strFlags.isEmpty()) { - strFlags = C.NONE.s(); + strFlags = Captions.NONE.s(); } - PlotMessage flags = new PlotMessage() - .text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))) + PlotMessage flags = new PlotMessage().text(Captions + .color(Captions.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))) .color("$1"); message.text("[").color("$3").text(i + "") .command("/plot visit " + plot.getArea() + ";" + plot.getId()) @@ -386,7 +404,7 @@ public class ListCmd extends SubCommand { prefix = ", "; } } - }, "/plot list " + args[0], C.PLOT_LIST_HEADER_PAGED.s()); + }, "/plot list " + args[0], Captions.PLOT_LIST_HEADER_PAGED.s()); } } 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 cc9106d28..234568fda 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic; @@ -22,23 +22,23 @@ import java.util.List; @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); if (!PlotSquared.get().hasPlotArea(world)) { - return !sendMessage(player, C.NOT_IN_PLOT_WORLD); + return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } final Plot plot = player.getCurrentPlot(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_LOAD)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_LOAD)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return false; } @@ -47,7 +47,7 @@ import java.util.List; List schematics = player.getMeta("plot_schematics"); if (schematics == null) { // No schematics found: - MainUtil.sendMessage(player, C.LOAD_NULL); + MainUtil.sendMessage(player, Captions.LOAD_NULL); return false; } String schem; @@ -55,8 +55,8 @@ import java.util.List; schem = schematics.get(Integer.parseInt(args[0]) - 1); } catch (Exception ignored) { // use /plot load - MainUtil - .sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')'); + MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, + "(1, " + schematics.size() + ')'); return false; } final URL url; @@ -64,16 +64,16 @@ import java.util.List; url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schem); } catch (MalformedURLException e) { e.printStackTrace(); - MainUtil.sendMessage(player, C.LOAD_FAILED); + MainUtil.sendMessage(player, Captions.LOAD_FAILED); return false; } plot.addRunning(); - MainUtil.sendMessage(player, C.GENERATING_COMPONENT); + MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); TaskManager.runTaskAsync(() -> { Schematic schematic = SchematicHandler.manager.getSchematic(url); if (schematic == null) { plot.removeRunning(); - sendMessage(player, C.SCHEMATIC_INVALID, + sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent or not in gzip format"); return; } @@ -84,9 +84,9 @@ import java.util.List; @Override public void run(Boolean value) { plot.removeRunning(); if (value) { - sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS); + sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS); } else { - sendMessage(player, C.SCHEMATIC_PASTE_FAILED); + sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED); } } }); @@ -94,7 +94,7 @@ import java.util.List; return true; } plot.removeRunning(); - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot load "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot load "); return false; } @@ -107,7 +107,7 @@ import java.util.List; List schematics1 = SchematicHandler.manager.getSaves(player.getUUID()); plot.removeRunning(); if ((schematics1 == null) || schematics1.isEmpty()) { - MainUtil.sendMessage(player, C.LOAD_FAILED); + MainUtil.sendMessage(player, Captions.LOAD_FAILED); return; } player.setMeta("plot_schematics", schematics1); @@ -141,7 +141,7 @@ import java.util.List; e.printStackTrace(); } } - MainUtil.sendMessage(player, C.LOAD_LIST); + MainUtil.sendMessage(player, Captions.LOAD_LIST); } public String secToTime(long time) { 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 0e1630e76..6f3ba0d28 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; import com.github.intellectualsites.plotsquared.plot.util.EconHandler; @@ -200,7 +200,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, C.PERMISSION_ADMIN)) && !newPlot + .equals(area) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN)) + && !newPlot .isDenied(player.getUUID())) { Location newLoc = newPlot.getCenter(); if (player.canTeleport(newLoc)) { @@ -212,7 +213,7 @@ public class MainCommand extends Command { player.setMeta(PlotPlayer.META_LOCATION, newLoc); player.setMeta(PlotPlayer.META_LAST_PLOT, newPlot); } else { - C.BORDER.send(player); + Captions.BORDER.send(player); } // Trim command args = Arrays.copyOfRange(args, 1, args.length); @@ -247,7 +248,7 @@ public class MainCommand extends Command { args = Arrays.copyOfRange(args, 1, args.length); break; default: - C.INVALID_COMMAND_FLAG.send(player); + Captions.INVALID_COMMAND_FLAG.send(player); return; } } @@ -260,9 +261,9 @@ public class MainCommand extends Command { e.printStackTrace(); String message = e.getLocalizedMessage(); if (message != null) { - C.ERROR.send(player, message); + Captions.ERROR.send(player, message); } else { - C.ERROR.send(player); + Captions.ERROR.send(player); } } // Reset command scope // 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 a944be561..970a0d35c 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.*; @@ -43,16 +43,16 @@ public class Merge extends SubCommand { Location loc = player.getLocationFull(); final Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } UUID uuid = player.getUUID(); if (!plot.isOwner(uuid)) { - if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_MERGE)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_MERGE)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } else { uuid = plot.guessOwner(); @@ -65,13 +65,13 @@ public class Merge extends SubCommand { final double price = priceExr == null ? 0d : priceExr.evaluate((double) size); if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d && EconHandler.manager.getMoney(player) < price) { - sendMessage(player, C.CANNOT_AFFORD_MERGE, String.valueOf(price)); + sendMessage(player, Captions.CANNOT_AFFORD_MERGE, String.valueOf(price)); return false; } final int maxSize = Permissions.hasPermissionRange(player, "plots.merge", Settings.Limit.MAX_PLOTS); if (size - 1 > maxSize) { - MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.merge." + (size + 1)); + MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.merge." + (size + 1)); return false; } int direction = -1; @@ -96,19 +96,21 @@ public class Merge extends SubCommand { if (args.length == 2) { terrain = "true".equalsIgnoreCase(args[1]); } - if (!terrain && !Permissions.hasPermission(player, C.PERMISSION_MERGE_KEEPROAD)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_KEEPROAD.s()); + if (!terrain && !Permissions + .hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_MERGE_KEEPROAD.s()); return true; } if (plot.autoMerge(-1, maxSize, uuid, terrain)) { if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { EconHandler.manager.withdrawMoney(player, price); - sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price)); + sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); } - MainUtil.sendMessage(player, C.SUCCESS_MERGE); + MainUtil.sendMessage(player, Captions.SUCCESS_MERGE); return true; } - MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE); + MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); return false; } @@ -120,10 +122,10 @@ public class Merge extends SubCommand { } } if (direction == -1) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); - MainUtil - .sendMessage(player, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw()))); + MainUtil.sendMessage(player, + Captions.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw()))); return false; } final boolean terrain; @@ -132,26 +134,27 @@ public class Merge extends SubCommand { } else { terrain = true; } - if (!terrain && !Permissions.hasPermission(player, C.PERMISSION_MERGE_KEEPROAD)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_KEEPROAD.s()); + if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_MERGE_KEEPROAD.s()); return true; } if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) { if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { EconHandler.manager.withdrawMoney(player, price); - sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price)); + sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); } - MainUtil.sendMessage(player, C.SUCCESS_MERGE); + MainUtil.sendMessage(player, Captions.SUCCESS_MERGE); return true; } Plot adjacent = plot.getRelative(direction); if (adjacent == null || !adjacent.hasOwner() || adjacent.getMerged((direction + 2) % 4) || adjacent.isOwner(uuid)) { - MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE); + MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); return false; } - if (!Permissions.hasPermission(player, C.PERMISSION_MERGE_OTHER)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER); + if (!Permissions.hasPermission(player, Captions.PERMISSION_MERGE_OTHER)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_MERGE_OTHER); return false; } java.util.Set uuids = adjacent.getOwners(); @@ -164,35 +167,35 @@ public class Merge extends SubCommand { isOnline = true; final int dir = direction; Runnable run = () -> { - MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED); + MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED); plot.autoMerge(dir, maxSize - size, owner, terrain); PlotPlayer plotPlayer = UUIDHandler.getPlayer(player.getUUID()); if (plotPlayer == null) { - sendMessage(accepter, C.MERGE_NOT_VALID); + sendMessage(accepter, Captions.MERGE_NOT_VALID); return; } if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d) { if (EconHandler.manager.getMoney(player) < price) { - sendMessage(player, C.CANNOT_AFFORD_MERGE, String.valueOf(price)); + sendMessage(player, Captions.CANNOT_AFFORD_MERGE, String.valueOf(price)); return; } EconHandler.manager.withdrawMoney(player, price); - sendMessage(player, C.REMOVED_BALANCE, String.valueOf(price)); + sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); } - MainUtil.sendMessage(player, C.SUCCESS_MERGE); + MainUtil.sendMessage(player, Captions.SUCCESS_MERGE); }; if (hasConfirmation(player)) { CmdConfirm.addPending(accepter, - C.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run); + Captions.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run); } else { run.run(); } } if (!isOnline) { - MainUtil.sendMessage(player, C.NO_AVAILABLE_AUTOMERGE); + MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); return false; } - MainUtil.sendMessage(player, C.MERGE_REQUESTED); + MainUtil.sendMessage(player, Captions.MERGE_REQUESTED); return true; } } 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 f4f184cc1..8fbec1ecb 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -18,10 +18,10 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; Location location = player.getLocation(); Plot plot = location.getPlot(); if (plot == null) { - return sendMessage(player, C.NOT_IN_PLOT); + return sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - return sendMessage(player, C.PLOT_UNOWNED); + return sendMessage(player, Captions.PLOT_UNOWNED); } player.teleport(plot.getCenter()); return true; 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 289a3c4a6..814d6b9cc 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; @@ -18,11 +18,11 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; Location loc = player.getLocation(); Plot plot1 = loc.getPlotAbs(); if (plot1 == null) { - return !MainUtil.sendMessage(player, C.NOT_IN_PLOT); + return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN.s())) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } boolean override = false; @@ -31,7 +31,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; override = true; } if (args.length != 1) { - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); @@ -45,19 +45,19 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; plot2 = area.getPlotAbs(plot1.getId()); } if (plot1.equals(plot2)) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot copy "); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy "); return false; } if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions - .hasPermission(player, C.PERMISSION_ADMIN.s()))) { - C.PLOTWORLD_INCOMPATIBLE.send(player); + .hasPermission(player, Captions.PERMISSION_ADMIN.s()))) { + Captions.PLOTWORLD_INCOMPATIBLE.send(player); return false; } - if (plot1.move(plot2, () -> MainUtil.sendMessage(player, C.MOVE_SUCCESS), false)) { + if (plot1.move(plot2, () -> MainUtil.sendMessage(player, Captions.MOVE_SUCCESS), false)) { return true; } else { - MainUtil.sendMessage(player, C.REQUIRES_UNOWNED); + MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED); return false; } } 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 b2e5170e5..e773879ae 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -23,10 +23,10 @@ import java.util.Locale; Location loc = player.getLocation(); final Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.isAdded(player.getUUID())) { - sendMessage(player, C.NO_PLOT_PERMS); + sendMessage(player, Captions.NO_PLOT_PERMS); return true; } PlotInventory inv = new PlotInventory(player, 2, "Plot Jukebox") { @@ -37,12 +37,12 @@ import java.util.Locale; } if (item.getPlotBlock().equalsAny(7, "bedrock")) { plot.removeFlag(Flags.MUSIC); - C.FLAG_REMOVED.send(player); + Captions.FLAG_REMOVED.send(player); } else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) { plot.setFlag(Flags.MUSIC, item.getPlotBlock().getRawId()); - C.FLAG_ADDED.send(player); + Captions.FLAG_ADDED.send(player); } else { - C.FLAG_NOT_ADDED.send(player); + Captions.FLAG_NOT_ADDED.send(player); } return false; } 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 c3e9c5f9e..0223245fc 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; @@ -18,7 +18,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; @Override public void execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); - C.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", ")); + final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); + Captions.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", ")); } } 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 4095c15c9..0e692748f 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -34,7 +34,7 @@ import java.util.UUID; if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value .equalsIgnoreCase("-")) { if (!Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) { + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) { return false; } Set connected = plot.getConnectedPlots(); @@ -43,20 +43,20 @@ import java.util.UUID; current.unclaim(); current.removeSign(); } - MainUtil.sendMessage(player, C.SET_OWNER); + MainUtil.sendMessage(player, Captions.SET_OWNER); return true; } - C.INVALID_PLAYER.send(player, value); + Captions.INVALID_PLAYER.send(player, value); return false; } final PlotPlayer other = UUIDHandler.getPlayer(uuid); if (plot.isOwner(uuid)) { - C.ALREADY_OWNER.send(player, MainUtil.getName(uuid)); + Captions.ALREADY_OWNER.send(player, MainUtil.getName(uuid)); return false; } - if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER)) { + if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER)) { if (other == null) { - C.INVALID_PLAYER_OFFLINE.send(player, value); + Captions.INVALID_PLAYER_OFFLINE.send(player, value); return false; } int size = plots.size(); @@ -64,7 +64,7 @@ import java.util.UUID; other.getPlotCount() : other.getPlotCount(plot.getWorldName())) + size; if (currentPlots > other.getAllowedPlots()) { - sendMessage(player, C.CANT_TRANSFER_MORE_PLOTS); + sendMessage(player, Captions.CANT_TRANSFER_MORE_PLOTS); return false; } } @@ -77,13 +77,14 @@ import java.util.UUID; if (removeDenied) plot.removeDenied(finalUUID); plot.setSign(finalName); - MainUtil.sendMessage(player, C.SET_OWNER); + MainUtil.sendMessage(player, Captions.SET_OWNER); if (other != null) { - MainUtil - .sendMessage(other, C.NOW_OWNER, plot.getArea() + ";" + plot.getId()); + MainUtil.sendMessage(other, Captions.NOW_OWNER, + plot.getArea() + ";" + plot.getId()); } - } else - MainUtil.sendMessage(player, C.SET_OWNER_CANCELLED); + } else { + MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED); + } } }; if (hasConfirmation(player)) { 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 a50ffbc90..0825b9610 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -38,7 +38,7 @@ import java.util.UUID; for (String arg : args) { String[] split = arg.split(":"); if (split.length != 2) { - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } switch (split[0].toLowerCase()) { @@ -50,7 +50,7 @@ import java.util.UUID; case "a": area = PlotSquared.get().getPlotAreaByString(split[1]); if (area == null) { - C.NOT_VALID_PLOT_WORLD.send(player, split[1]); + Captions.NOT_VALID_PLOT_WORLD.send(player, split[1]); return false; } break; @@ -59,7 +59,7 @@ import java.util.UUID; try { id = PlotId.fromString(split[1]); } catch (IllegalArgumentException ignored) { - C.NOT_VALID_PLOT_ID.send(player, split[1]); + Captions.NOT_VALID_PLOT_ID.send(player, split[1]); return false; } break; @@ -67,7 +67,7 @@ import java.util.UUID; case "o": owner = UUIDHandler.getUUID(split[1], null); if (owner == null) { - C.INVALID_PLAYER.send(player, split[1]); + Captions.INVALID_PLAYER.send(player, split[1]); return false; } break; @@ -75,7 +75,7 @@ import java.util.UUID; case "s": added = UUIDHandler.getUUID(split[1], null); if (added == null) { - C.INVALID_PLAYER.send(player, split[1]); + Captions.INVALID_PLAYER.send(player, split[1]); return false; } break; @@ -85,7 +85,7 @@ import java.util.UUID; unknown = Boolean.parseBoolean(split[1]); break; default: - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } } @@ -137,7 +137,7 @@ import java.util.UUID; } } if (toDelete.isEmpty()) { - C.FOUND_NO_PLOTS.send(player); + Captions.FOUND_NO_PLOTS.send(player); return false; } String cmd = @@ -156,7 +156,7 @@ import java.util.UUID; } } DBFunc.purgeIds(ids); - C.PURGE_SUCCESS.send(player, ids.size() + "/" + toDelete.size()); + Captions.PURGE_SUCCESS.send(player, ids.size() + "/" + toDelete.size()); }; if (hasConfirmation(player)) { CmdConfirm.addPending(player, cmd, run); 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 8446b62a3..7c9705475 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.Flags; @@ -48,48 +48,50 @@ import java.util.UUID; .isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p .isAdded(uuid)) { p.teleportPlayer(player); - MainUtil.sendMessage(player, C.RATE_THIS); + MainUtil.sendMessage(player, Captions.RATE_THIS); return true; } } - MainUtil.sendMessage(player, C.FOUND_NO_PLOTS); + MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS); return false; } case "purge": { final Plot plot = player.getCurrentPlot(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } - if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_RATE, true)) { + if (!Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_RATE, true)) { return false; } plot.clearRatings(); - C.RATINGS_PURGED.send(player); + Captions.RATINGS_PURGED.send(player); return true; } } } final Plot plot = player.getCurrentPlot(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - sendMessage(player, C.RATING_NOT_OWNED); + sendMessage(player, Captions.RATING_NOT_OWNED); return false; } if (plot.isOwner(player.getUUID())) { - sendMessage(player, C.RATING_NOT_YOUR_OWN); + sendMessage(player, Captions.RATING_NOT_YOUR_OWN); return false; } if (Settings.Done.REQUIRED_FOR_RATINGS && !plot.hasFlag(Flags.DONE)) { - sendMessage(player, C.RATING_NOT_DONE); + sendMessage(player, Captions.RATING_NOT_DONE); return false; } if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) { final Runnable run = new Runnable() { @Override public void run() { if (plot.getRatings().containsKey(player.getUUID())) { - sendMessage(player, C.RATING_ALREADY_EXISTS, plot.getId().toString()); + sendMessage(player, Captions.RATING_ALREADY_EXISTS, + plot.getId().toString()); return; } final MutableInt index = new MutableInt(0); @@ -105,14 +107,14 @@ import java.util.UUID; EventUtil.manager.callRating(this.player, plot, new Rating(rV)); if (result != null) { plot.addRating(this.player.getUUID(), result); - sendMessage(this.player, C.RATING_APPLIED, + sendMessage(this.player, Captions.RATING_APPLIED, plot.getId().toString()); if (Permissions - .hasPermission(this.player, C.PERMISSION_COMMENT)) { + .hasPermission(this.player, Captions.PERMISSION_COMMENT)) { Command command = MainCommand.getInstance().getCommand(Comment.class); if (command != null) { - MainUtil.sendMessage(this.player, C.COMMENT_THIS, + MainUtil.sendMessage(this.player, Captions.COMMENT_THIS, command.getUsage()); } } @@ -149,7 +151,7 @@ import java.util.UUID; return true; } if (args.length < 1) { - sendMessage(player, C.RATING_NOT_VALID); + sendMessage(player, Captions.RATING_NOT_VALID); return true; } String arg = args[0]; @@ -157,23 +159,23 @@ import java.util.UUID; if (MathMan.isInteger(arg) && arg.length() < 3 && !arg.isEmpty()) { rating = Integer.parseInt(arg); if (rating > 10 || rating < 1) { - sendMessage(player, C.RATING_NOT_VALID); + sendMessage(player, Captions.RATING_NOT_VALID); return false; } } else { - sendMessage(player, C.RATING_NOT_VALID); + sendMessage(player, Captions.RATING_NOT_VALID); return false; } final UUID uuid = player.getUUID(); final Runnable run = () -> { if (plot.getRatings().containsKey(uuid)) { - sendMessage(player, C.RATING_ALREADY_EXISTS, plot.getId().toString()); + sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString()); return; } Rating result = EventUtil.manager.callRating(player, plot, new Rating(rating)); if (result != null) { plot.addRating(uuid, result); - sendMessage(player, C.RATING_APPLIED, plot.getId().toString()); + sendMessage(player, Captions.RATING_APPLIED, plot.getId().toString()); } }; if (plot.getSettings().ratings == null) { 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 9edf20a62..9fcdc811d 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; @@ -22,24 +22,25 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; try { height = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { - MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(0, 256)"); - MainUtil - .sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads [height]"); + MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot regenallroads [height]"); return false; } } else if (args.length != 1) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads [height]"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot regenallroads [height]"); return false; } PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); if (area == null) { - C.NOT_VALID_PLOT_WORLD.send(player, args[0]); + Captions.NOT_VALID_PLOT_WORLD.send(player, args[0]); return false; } String name = args[0]; PlotManager manager = area.getPlotManager(); if (!(manager instanceof HybridPlotManager)) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD); return false; } //Set chunks = ChunkManager.manager.getChunkChunks(name); 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 79a87b887..65656117a 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; @@ -20,7 +20,7 @@ import java.util.HashSet; RunnableVal2 whenDone) { final Plot plot = player.getCurrentPlot(); if (plot == null) { - C.NOT_IN_PLOT.send(player); + Captions.NOT_IN_PLOT.send(player); return; } HashSet regions = plot.getRegions(); @@ -32,7 +32,7 @@ import java.util.HashSet; }, new Runnable() { @Override public void run() { plot.refreshChunks(); - C.SET_BLOCK_ACTION_FINISHED.send(player); + Captions.SET_BLOCK_ACTION_FINISHED.send(player); } }, 5); } 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 bee93e15d..db900e91e 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 @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -21,7 +21,7 @@ import java.util.Objects; // The following won't affect world generation, as that has to be // loaded during startup unfortunately. PlotSquared.get().setupConfigs(); - C.load(PlotSquared.get().translationFile); + Captions.load(PlotSquared.get().translationFile); PlotSquared.get().forEachPlotArea(area -> { ConfigurationSection worldSection = PlotSquared.get().worlds.getConfigurationSection("worlds." + area.worldname); @@ -70,10 +70,10 @@ import java.util.Objects; } }); PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); - MainUtil.sendMessage(player, C.RELOADED_CONFIGS); + MainUtil.sendMessage(player, Captions.RELOADED_CONFIGS); } catch (IOException e) { e.printStackTrace(); - MainUtil.sendMessage(player, C.RELOAD_FAILED); + MainUtil.sendMessage(player, Captions.RELOAD_FAILED); } return true; } 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 bf027f20d..30c364671 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -30,15 +30,15 @@ import java.util.UUID; Location location = player.getLocation(); Plot plot = location.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_REMOVE)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_REMOVE)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return true; } int count = 0; @@ -98,10 +98,10 @@ import java.util.UUID; break; } if (count == 0) { - MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); + MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); return false; } else { - MainUtil.sendMessage(player, C.REMOVED_PLAYERS, count + ""); + MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, count + ""); } return true; } 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 aec9543ed..d408ce2fa 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; @@ -21,23 +21,23 @@ import java.util.UUID; @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); if (!PlotSquared.get().hasPlotArea(world)) { - return !sendMessage(player, C.NOT_IN_PLOT_WORLD); + return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD); } final Plot plot = player.getCurrentPlot(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SAVE)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SAVE)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return false; } plot.addRunning(); @@ -58,10 +58,10 @@ import java.util.UUID; @Override public void run(URL url) { plot.removeRunning(); if (url == null) { - MainUtil.sendMessage(player, C.SAVE_FAILED); + MainUtil.sendMessage(player, Captions.SAVE_FAILED); return; } - MainUtil.sendMessage(player, C.SAVE_SUCCESS); + MainUtil.sendMessage(player, Captions.SAVE_SUCCESS); List schematics = player.getMeta("plot_schematics"); if (schematics != null) { schematics.add(file + ".schematic"); 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 110992543..48f0a8a1c 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic; @@ -22,32 +22,33 @@ public class SchematicCmd extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length < 1) { - sendMessage(player, C.SCHEMATIC_MISSING_ARG); + sendMessage(player, Captions.SCHEMATIC_MISSING_ARG); return true; } String arg = args[0].toLowerCase(); switch (arg) { case "paste": { - if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_PASTE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_PASTE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_PASTE)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_SCHEMATIC_PASTE); return false; } if (args.length < 2) { - sendMessage(player, C.SCHEMATIC_MISSING_ARG); + sendMessage(player, Captions.SCHEMATIC_MISSING_ARG); break; } Location loc = player.getLocation(); final Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } if (this.running) { @@ -66,7 +67,7 @@ public class SchematicCmd extends SubCommand { schematic = SchematicHandler.manager.getSchematic(url); } catch (Exception e) { e.printStackTrace(); - sendMessage(player, C.SCHEMATIC_INVALID, + sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent url: " + location); SchematicCmd.this.running = false; return; @@ -80,7 +81,7 @@ public class SchematicCmd extends SubCommand { } if (schematic == null) { SchematicCmd.this.running = false; - sendMessage(player, C.SCHEMATIC_INVALID, + sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent or not in gzip format"); return; } @@ -89,9 +90,9 @@ public class SchematicCmd extends SubCommand { @Override public void run(Boolean value) { SchematicCmd.this.running = false; if (value) { - sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS); + sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS); } else { - sendMessage(player, C.SCHEMATIC_PASTE_FAILED); + sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED); } } }); @@ -101,39 +102,39 @@ public class SchematicCmd extends SubCommand { // TODO test // case "test": { // if (!Permissions.hasPermission(plr, "plots.schematic.test")) { - // MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.test"); + // MainUtil.sendMessage(plr, Captions.NO_PERMISSION, "plots.schematic.test"); // return false; // } // if (args.length < 2) { - // sendMessage(plr, C.SCHEMATIC_MISSING_ARG); + // sendMessage(plr, Captions.SCHEMATIC_MISSING_ARG); // return false; // } // final Location loc = plr.getLocation(); // final Plot plot = MainUtil.getPlot(loc); // if (plot == null) { - // sendMessage(plr, C.NOT_IN_PLOT); + // sendMessage(plr, Captions.NOT_IN_PLOT); // return false; // } // file = args[1]; // schematic = SchematicHandler.manager.getSchematic(file); // if (schematic == null) { - // sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent"); + // sendMessage(plr, Captions.SCHEMATIC_INVALID, "non-existent"); // return false; // } // final int l1 = schematic.getSchematicDimension().getX(); // final int l2 = schematic.getSchematicDimension().getZ(); // final int length = MainUtil.getPlotWidth(loc.getWorld(), plot.id); // if ((l1 < length) || (l2 < length)) { - // sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length)); + // sendMessage(plr, Captions.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length)); // break; // } - // sendMessage(plr, C.SCHEMATIC_VALID); + // sendMessage(plr, Captions.SCHEMATIC_VALID); // break; // } case "saveall": case "exportall": { if (!(player instanceof ConsolePlayer)) { - MainUtil.sendMessage(player, C.NOT_CONSOLE); + MainUtil.sendMessage(player, Captions.NOT_CONSOLE); return false; } if (args.length != 2) { @@ -143,7 +144,7 @@ public class SchematicCmd extends SubCommand { } PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]); if (area == null) { - C.NOT_VALID_PLOT_WORLD.send(player, args[1]); + Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]); return false; } Collection plots = area.getPlots(); @@ -167,8 +168,9 @@ public class SchematicCmd extends SubCommand { } case "export": case "save": - if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_SAVE)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_SAVE); + if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_SAVE)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_SCHEMATIC_SAVE); return false; } if (this.running) { @@ -178,15 +180,15 @@ public class SchematicCmd extends SubCommand { Location location = player.getLocation(); Plot plot = location.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, C.PLOT_UNOWNED); + MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); return false; } if (!plot.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } location.getWorld(); @@ -204,17 +206,18 @@ public class SchematicCmd extends SubCommand { } break; case "list": { - if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_LIST)) { - MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_LIST); + if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_LIST)) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_SCHEMATIC_LIST); return false; } final String string = StringMan.join(SchematicHandler.manager.getShematicNames(), "$2, $1"); - C.SCHEMATIC_LIST.send(player, string); + Captions.SCHEMATIC_LIST.send(player, string); } break; default: - sendMessage(player, C.SCHEMATIC_MISSING_ARG); + sendMessage(player, Captions.SCHEMATIC_MISSING_ARG); break; } return true; 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 6d8dc9c22..6f9277166 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.config.Configuration.UnknownBlockException; import com.github.intellectualsites.plotsquared.plot.flag.Flag; @@ -47,17 +47,17 @@ import java.util.stream.IntStream; for (String component : components) { if (component.equalsIgnoreCase(args[0])) { - if (!Permissions - .hasPermission(player, C.PERMISSION_SET_COMPONENT.f(component))) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_SET_COMPONENT.f(component)); + if (!Permissions.hasPermission(player, + Captions.PERMISSION_SET_COMPONENT.f(component))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_SET_COMPONENT.f(component)); return false; } // PlotBlock[] blocks; BlockBucket bucket; try { if (args.length < 2) { - MainUtil.sendMessage(player, C.NEED_BLOCK); + MainUtil.sendMessage(player, Captions.NEED_BLOCK); return true; } String[] split = material.split(","); @@ -67,14 +67,14 @@ import java.util.stream.IntStream; bucket = Configuration.BLOCK_BUCKET.parseString(material); } catch (final UnknownBlockException unknownBlockException) { final String unknownBlock = unknownBlockException.getUnknownValue(); - C.NOT_VALID_BLOCK.send(player, unknownBlock); + Captions.NOT_VALID_BLOCK.send(player, unknownBlock); StringComparison.ComparisonResult match = WorldUtil.IMP.getClosestBlock(unknownBlock); if (match != null) { final String found = WorldUtil.IMP.getClosestMatchingName(match.best); if (found != null) { - MainUtil.sendMessage(player, C.DID_YOU_MEAN, + MainUtil.sendMessage(player, Captions.DID_YOU_MEAN, found.toLowerCase()); } } @@ -84,24 +84,24 @@ import java.util.stream.IntStream; if (!allowUnsafe) { for (final PlotBlock block : bucket.getBlocks()) { if (!block.isAir() && !WorldUtil.IMP.isBlockSolid(block)) { - C.NOT_ALLOWED_BLOCK.send(player, block.toString()); + Captions.NOT_ALLOWED_BLOCK.send(player, block.toString()); return false; } } } } catch (Exception ignored) { - MainUtil.sendMessage(player, C.NOT_VALID_BLOCK, material); + MainUtil.sendMessage(player, Captions.NOT_VALID_BLOCK, material); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, C.WAIT_FOR_TIMER); + MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); return false; } plot.addRunning(); for (Plot current : plot.getConnectedPlots()) { current.setComponent(component, bucket); } - MainUtil.sendMessage(player, C.GENERATING_COMPONENT); + MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); GlobalBlockQueue.IMP.addTask(plot::removeRunning); return true; } @@ -119,8 +119,8 @@ import java.util.stream.IntStream; newValues.addAll( Arrays.asList(plot.getManager().getPlotComponents(plot.getArea(), plot.getId()))); } - MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan - .join(newValues, C.BLOCK_LIST_SEPARATER.formatted())); + MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan + .join(newValues, Captions.BLOCK_LIST_SEPARATER.formatted())); return false; } @@ -139,7 +139,7 @@ import java.util.stream.IntStream; // Additional checks Plot plot = player.getCurrentPlot(); if (plot == null) { - MainUtil.sendMessage(player, C.NOT_IN_PLOT); + MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); return false; } // components 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 aaa1adfa2..bc64f0244 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 @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.plot.commands; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -14,21 +14,23 @@ public abstract class SetCommand extends SubCommand { Location loc = player.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { - return !sendMessage(player, C.NOT_IN_PLOT); + return !sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot.hasOwner()) { - if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_ADMIN_COMMAND.f(getFullId())); - MainUtil.sendMessage(player, C.PLOT_NOT_CLAIMED); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_ADMIN_COMMAND.f(getFullId())); + MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED); return false; } } if (!plot.isOwner(player.getUUID())) { - if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { - MainUtil.sendMessage(player, C.NO_PERMISSION, - C.PERMISSION_ADMIN_COMMAND.f(getFullId())); - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + if (!Permissions + .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) { + MainUtil.sendMessage(player, Captions.NO_PERMISSION, + Captions.PERMISSION_ADMIN_COMMAND.f(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 fc92cc550..af0968a92 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.BlockLoc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -21,7 +21,7 @@ public class SetHome extends SetCommand { case "none": { Plot base = plot.getBasePlot(false); base.setHome(null); - return MainUtil.sendMessage(player, C.POSITION_UNSET); + return MainUtil.sendMessage(player, Captions.POSITION_UNSET); } case "": Plot base = plot.getBasePlot(false); @@ -31,9 +31,9 @@ public class SetHome extends SetCommand { new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(), loc.getYaw(), loc.getPitch()); base.setHome(rel); - return MainUtil.sendMessage(player, C.POSITION_SET); + return MainUtil.sendMessage(player, Captions.POSITION_SET); default: - MainUtil.sendMessage(player, C.HOME_ARGUMENT); + MainUtil.sendMessage(player, Captions.HOME_ARGUMENT); return false; } } 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 412927526..5dc5973d4 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 @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; @@ -43,7 +43,7 @@ import java.util.Map.Entry; object = new SetupObject(); player.setMeta("setup", object); SetupUtils.manager.updateGenerators(); - sendMessage(player, C.SETUP_INIT); + sendMessage(player, Captions.SETUP_INIT); displayGenerators(player); return false; } @@ -57,7 +57,8 @@ import java.util.Map.Entry; if (object.setup_index > 0) { object.setup_index--; ConfigurationNode node = object.step[object.setup_index]; - sendMessage(player, C.SETUP_STEP, object.setup_index + 1, node.getDescription(), + sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, + node.getDescription(), node.getType().getType(), String.valueOf(node.getDefaultValue())); return false; } else if (object.current > 0) { @@ -75,7 +76,7 @@ import java.util.Map.Entry; .join(SetupUtils.generators.keySet(), prefix) .replaceAll(PlotSquared.imp().getPluginName(), "&2" + PlotSquared.imp().getPluginName())); - sendMessage(player, C.SETUP_INIT); + sendMessage(player, Captions.SETUP_INIT); return false; } object.setupGenerator = args[0]; @@ -129,7 +130,8 @@ import java.util.Map.Entry; return true; } ConfigurationNode step = object.step[object.setup_index]; - sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), + sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, + step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); } else { if (gen.isFull()) { @@ -231,7 +233,8 @@ import java.util.Map.Entry; .getSettingNodes(); } ConfigurationNode step = object.step[object.setup_index]; - sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), + sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, + step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); break; } @@ -244,7 +247,8 @@ import java.util.Map.Entry; } ConfigurationNode step = object.step[object.setup_index]; if (args.length < 1) { - sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), + sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, + step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); return false; } @@ -253,10 +257,10 @@ import java.util.Map.Entry; try { valid = step.isValid(args[0]); } catch (final Configuration.UnsafeBlockException e) { - C.NOT_ALLOWED_BLOCK.send(player, e.getUnsafeBlock().toString()); + Captions.NOT_ALLOWED_BLOCK.send(player, e.getUnsafeBlock().toString()); } if (valid) { - sendMessage(player, C.SETUP_VALID_ARG, step.getConstant(), args[0]); + sendMessage(player, Captions.SETUP_VALID_ARG, step.getConstant(), args[0]); step.setValue(args[0]); object.setup_index++; if (object.setup_index == object.step.length) { @@ -264,12 +268,14 @@ import java.util.Map.Entry; return false; } step = object.step[object.setup_index]; - sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), + sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, + step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); return false; } else { - sendMessage(player, C.SETUP_INVALID_ARG, args[0], step.getConstant()); - sendMessage(player, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), + sendMessage(player, Captions.SETUP_INVALID_ARG, args[0], step.getConstant()); + sendMessage(player, Captions.SETUP_STEP, object.setup_index + 1, + step.getDescription(), step.getType().getType(), String.valueOf(step.getDefaultValue())); return false; } @@ -302,7 +308,7 @@ import java.util.Map.Entry; player.sendMessage("&cAn error occurred. See console for more information"); e.printStackTrace(); } - sendMessage(player, C.SETUP_FINISHED, object.world); + sendMessage(player, Captions.SETUP_FINISHED, object.world); } return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java index 396185e29..82bb3a17d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SubCommand.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.Command; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; @@ -32,7 +32,7 @@ public abstract class SubCommand extends Command { public abstract boolean onCommand(PlotPlayer player, String[] args); - public boolean sendMessage(PlotPlayer player, C message, Object... args) { + public boolean sendMessage(PlotPlayer player, Captions message, Object... args) { message.send(player, args); return true; } 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 80a96dfb6..d911ae3a5 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 @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -16,15 +16,15 @@ public class Swap extends SubCommand { Location loc = player.getLocation(); Plot plot1 = loc.getPlotAbs(); if (plot1 == null) { - return !MainUtil.sendMessage(player, C.NOT_IN_PLOT); + return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, C.PERMISSION_ADMIN.s())) { - MainUtil.sendMessage(player, C.NO_PLOT_PERMS); + .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } if (args.length != 1) { - C.COMMAND_SYNTAX.send(player, getUsage()); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } Plot plot2 = MainUtil.getPlotFromString(player, args[0], true); @@ -32,22 +32,22 @@ public class Swap extends SubCommand { return false; } if (plot1.equals(plot2)) { - MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID); - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot copy "); + MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy "); return false; } if (!plot1.getArea().isCompatible(plot2.getArea())) { - C.PLOTWORLD_INCOMPATIBLE.send(player); + Captions.PLOTWORLD_INCOMPATIBLE.send(player); return false; } if (plot1.move(plot2, new Runnable() { @Override public void run() { - MainUtil.sendMessage(player, C.SWAP_SUCCESS); + MainUtil.sendMessage(player, Captions.SWAP_SUCCESS); } }, true)) { return true; } else { - MainUtil.sendMessage(player, C.SWAP_OVERLAP); + MainUtil.sendMessage(player, Captions.SWAP_OVERLAP); return false; } } 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 03879463a..4dd37bdb0 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 @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -22,7 +22,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; @Override public boolean onCommand(PlotPlayer player, String[] args) { Location location = player.getLocation(); if (!location.isPlotArea()) { - MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD); + MainUtil.sendMessage(player, Captions.NOT_IN_PLOT_WORLD); return false; } Plot target = null; @@ -36,14 +36,14 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; } } if (target == null) { - MainUtil.sendMessage(player, C.FOUND_NO_PLOTS); + MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS); return false; } } else if ((target = MainUtil.getPlotFromString(player, args[0], true)) == null) { return false; } player.setCompassTarget(target.getCenter()); - MainUtil.sendMessage(player, C.COMPASS_TARGET); + MainUtil.sendMessage(player, Captions.COMPASS_TARGET); return true; } } 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 aed9c5ca6..424878e27 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 @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -107,15 +107,16 @@ import java.util.zip.ZipOutputStream; if (args.length != 2 && args.length != 3) { if (args.length == 1) { if (args[0].equalsIgnoreCase("export")) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot template export "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, + "/plot template export "); return true; } else if (args[0].equalsIgnoreCase("import")) { - MainUtil.sendMessage(player, C.COMMAND_SYNTAX, + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot template import