From 8f685b754acb9c297c1f6ea9d1a629c98bc77aa0 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 6 Aug 2019 20:35:36 -0400 Subject: [PATCH] Modifications to formatting and UUID Handler Fixes #2423 --- .../bukkit/listeners/ChunkListener.java | 18 +- .../bukkit/listeners/PlayerEvents.java | 12 +- .../bukkit/object/BukkitPlayer.java | 6 +- .../bukkit/uuid/FileUUIDHandler.java | 7 + .../plotsquared/api/PlotAPI.java | 2 +- .../plotsquared/commands/Command.java | 25 +- .../plotsquared/plot/PlotSquared.java | 41 +- .../plotsquared/plot/commands/Alias.java | 5 +- .../plotsquared/plot/commands/Area.java | 6 +- .../plotsquared/plot/commands/Biome.java | 10 +- .../plotsquared/plot/commands/Cluster.java | 5 +- .../plot/commands/CommandCategory.java | 4 +- .../plotsquared/plot/commands/Copy.java | 2 +- .../plotsquared/plot/commands/Debug.java | 8 +- .../plotsquared/plot/commands/DebugPaste.java | 4 +- .../plotsquared/plot/commands/Deny.java | 2 +- .../plotsquared/plot/commands/Download.java | 8 +- .../plot/commands/GenerateDocs.java | 6 +- .../plotsquared/plot/commands/Help.java | 9 +- .../plotsquared/plot/commands/Inbox.java | 3 +- .../plotsquared/plot/commands/Info.java | 41 +- .../plotsquared/plot/commands/Kick.java | 2 +- .../plotsquared/plot/commands/ListCmd.java | 16 +- .../plotsquared/plot/commands/Merge.java | 10 +- .../plotsquared/plot/commands/Move.java | 4 +- .../plotsquared/plot/commands/Owner.java | 4 +- .../plotsquared/plot/commands/Set.java | 3 +- .../plotsquared/plot/commands/Swap.java | 2 +- .../plotsquared/plot/config/Captions.java | 698 +++++++----------- .../plot/generator/HybridUtils.java | 8 +- .../plot/listener/PlotListener.java | 32 +- .../plotsquared/plot/object/Plot.java | 2 +- .../plotsquared/plot/object/PlotPlayer.java | 6 +- .../plotsquared/plot/util/CommentManager.java | 4 +- .../plotsquared/plot/util/EventUtil.java | 184 ++--- .../plotsquared/plot/util/MainUtil.java | 34 +- .../plotsquared/plot/util/Permissions.java | 10 +- .../plotsquared/plot/util/UUIDHandler.java | 2 +- .../plot/util/helpmenu/HelpObject.java | 2 +- .../plot/util/helpmenu/HelpPage.java | 7 +- 40 files changed, 546 insertions(+), 708 deletions(-) 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 c55e4f440..c93767ea5 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 @@ -223,8 +223,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(Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(Captions.PREFIX.getTranslated() + + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -232,8 +232,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(Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(Captions.PREFIX.getTranslated() + + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -243,8 +243,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( - Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(Captions.PREFIX.getTranslated() + + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true); return; } @@ -268,13 +268,15 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils } } PlotSquared.debug( - Captions.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() + Captions.PREFIX.getTranslated() + "&a detected unsafe chunk and processed: " + ( + chunk.getX() << 4) + "," + (chunk.getX() << 4)); } if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { PlotSquared.debug( - Captions.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + Captions.PREFIX.getTranslated() + "&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/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index b9c1b72c0..938cc8b9a 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 @@ -637,7 +637,7 @@ import java.util.regex.Pattern; EventUtil.manager.doJoinTask(pp); }, 20); - if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.s()) + if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.getTranslated()) && PlotSquared.get().getUpdateUtility() != null) { final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class); @@ -941,7 +941,7 @@ import java.util.regex.Pattern; } event.setCancelled(true); String message = event.getMessage(); - String format = Captions.PLOT_CHAT_FORMAT.s(); + String format = Captions.PLOT_CHAT_FORMAT.getTranslated(); String sender = event.getPlayer().getDisplayName(); PlotId id = plot.getId(); Set recipients = event.getRecipients(); @@ -968,8 +968,8 @@ import java.util.regex.Pattern; receiver.sendMessage(full); } if (!spies.isEmpty()) { - String spyMessage = - Captions.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y) + String spyMessage = Captions.PLOT_CHAT_SPY_FORMAT.getTranslated() + .replace("%plot_id%", id.x + ";" + id.y) .replace("%sender%", sender).replace("%msg%", message); for (Player player : spies) { player.sendMessage(spyMessage); @@ -1001,7 +1001,7 @@ import java.util.regex.Pattern; && !Permissions .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { event.setCancelled(true); - MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.s() + MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.getTranslated() .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { @@ -2991,7 +2991,7 @@ import java.util.regex.Pattern; if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT) && !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { event.setCancelled(true); - MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.s() + MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.getTranslated() .replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { 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 5587a698d..d16038215 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 @@ -112,15 +112,15 @@ public class BukkitPlayer extends PlotPlayer { } @Override public int hasPermissionRange(final String stub, final int range) { - if (hasPermission(Captions.PERMISSION_ADMIN.s())) { + if (hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { return Integer.MAX_VALUE; } final String[] nodes = stub.split("\\."); final StringBuilder n = new StringBuilder(); for (int i = 0; i < (nodes.length - 1); i++) { n.append(nodes[i]).append("."); - if (!stub.equals(n + Captions.PERMISSION_STAR.s())) { - if (hasPermission(n + Captions.PERMISSION_STAR.s())) { + if (!stub.equals(n + Captions.PERMISSION_STAR.getTranslated())) { + if (hasPermission(n + Captions.PERMISSION_STAR.getTranslated())) { return Integer.MAX_VALUE; } } 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 38b30d3b4..440aca318 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 @@ -218,6 +218,13 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { StringWrapper wrap = new StringWrapper(name); if (!toAdd.containsKey(wrap)) { UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(offlinePlotPlayer); + if (toAdd.containsValue(uuid)) { + StringWrapper duplicate = toAdd.inverse().get(uuid); + PlotSquared.debug( + "The UUID: " + uuid.toString() + " is already mapped to " + + duplicate + + "\n It cannot be added to the Map with a key of " + wrap); + } toAdd.putIfAbsent(wrap, uuid); if (ExpireManager.IMP != null) { ExpireManager.IMP.storeDate(uuid, last); 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 d2b4e7343..610362953 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 @@ -165,7 +165,7 @@ import java.util.UUID; * @see Captions */ public void sendConsoleMessage(Captions caption) { - sendConsoleMessage(caption.s()); + sendConsoleMessage(caption.getTranslated()); } /** 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 d3afeae73..945d2d374 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 @@ -38,19 +38,19 @@ public abstract class Command { private RequiredType required; private String usage; private String description; - private String perm; + private String permission; private boolean confirmation; private CommandCategory category; private Argument[] arguments; - public Command(Command parent, boolean isStatic, String id, String perm, RequiredType required, - CommandCategory cat) { + public Command(Command parent, boolean isStatic, String id, String permission, + RequiredType required, CommandCategory category) { this.parent = parent; this.isStatic = isStatic; this.id = id; - this.perm = perm; + this.permission = permission; this.required = required; - this.category = cat; + this.category = category; this.aliases = Arrays.asList(id); if (this.parent != null) { this.parent.register(this); @@ -154,7 +154,7 @@ public abstract class Command { public void init(CommandDeclaration declaration) { this.id = declaration.command(); - this.perm = declaration.permission(); + this.permission = declaration.permission(); this.required = declaration.requiredType(); this.category = declaration.category(); List aliasOptions = new ArrayList<>(); @@ -204,8 +204,8 @@ public abstract class Command { } public String getPermission() { - if (this.perm != null && !this.perm.isEmpty()) { - return this.perm; + if (this.permission != null && !this.permission.isEmpty()) { + return this.permission; } if (this.parent == null) { return "plots.use"; @@ -244,18 +244,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(Captions.CLICKABLE.s()).color("$2").send(player); + .text(Captions.CLICKABLE.getTranslated()).color("$2").send(player); return; } if (page == 0 && totalPages != 0) { // Next new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1") - .command(baseCommand + " " + 2).text(Captions.CLICKABLE.s()).color("$2") + .command(baseCommand + " " + 2).text(Captions.CLICKABLE.getTranslated()).color("$2") .send(player); return; } if (totalPages != 0) { // Back new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ") - .color("$3").text("->").color("$3").text(Captions.CLICKABLE.s()).color("$2") + .color("$3").text("->").color("$3").text(Captions.CLICKABLE.getTranslated()) + .color("$2") .send(player); } } @@ -489,7 +490,7 @@ public abstract class Command { return null; } List result = new ArrayList<>(); - int index = input.length - (space ? 0 : 1); + int index = input.length; for (String arg : args) { arg = arg.replace(getCommandString() + " ", ""); String[] split = arg.split(" "); 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 589309385..2f8fc8235 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 @@ -54,8 +54,7 @@ import java.util.zip.ZipInputStream; * An implementation of the core, with a static getter for easy access. */ @SuppressWarnings({"unused", "WeakerAccess"}) public class PlotSquared { - private static final Set EMPTY_SET = Collections. - unmodifiableSet(Collections.emptySet()); + private static final Set EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet()); private static PlotSquared instance; // Implementation public final IPlotMain IMP; @@ -217,21 +216,6 @@ import java.util.zip.ZipInputStream; .runTask(() -> EconHandler.manager = PlotSquared.this.IMP.getEconomyHandler()); } -/* // Check for updates - if (Settings.Enabled_Components.UPDATER) { - updater = new Updater(); - TaskManager.IMP.taskAsync(new Runnable() { - @Override public void run() { - updater.update(getPlatform(), getVersion()); - } - }); - TaskManager.IMP.taskRepeatAsync(new Runnable() { - @Override public void run() { - updater.update(getPlatform(), getVersion()); - } - }, 36000); - }*/ - // World generators: final ConfigurationSection section = this.worlds.getConfigurationSection("worlds"); if (section != null) { @@ -249,13 +233,14 @@ import java.util.zip.ZipInputStream; continue; } if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) { - debug( - "&c`" + world + "` was not properly loaded - " + IMP.getPluginName() + debug("`" + world + "` was not properly loaded - " + IMP.getPluginName() + " will now try to load it properly: "); debug( - "&8 - &7Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); + " - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); debug( - "&8 - &7Your world management plugin may be faulty (or non existent)"); + " - Your world management plugin may be faulty (or non existent)"); + debug( + " This message may also be a false positive and could be ignored."); PlotSquared.this.IMP.setGenerator(world); } } @@ -614,9 +599,7 @@ import java.util.zip.ZipInputStream; */ private void sortPlotsByHash(Plot[] input) { List[] bucket = new ArrayList[32]; - for (int i = 0; i < bucket.length; i++) { - bucket[i] = new ArrayList<>(); - } + Arrays.fill(bucket, new ArrayList<>()); boolean maxLength = false; int placement = 1; while (!maxLength) { @@ -1191,7 +1174,7 @@ import java.util.zip.ZipInputStream; "Invalid type for multi-area world. Expected `2`, got `" + 1 + "`"); } for (String areaId : areasSection.getKeys(false)) { - PlotSquared.log(Captions.PREFIX + "&3 - " + areaId); + PlotSquared.log(Captions.PREFIX + " - " + areaId); String[] split = areaId.split("(?<=[^;-])-"); if (split.length != 3) { throw new IllegalArgumentException("Invalid Area identifier: " + areaId @@ -1678,11 +1661,11 @@ import java.util.zip.ZipInputStream; .getString("configuration_version") .equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION)) { // Conversion needed - log(Captions.LEGACY_CONFIG_FOUND.s()); + log(Captions.LEGACY_CONFIG_FOUND.getTranslated()); try { com.google.common.io.Files .copy(this.worldsFile, new File(folder, "worlds.yml.old")); - log(Captions.LEGACY_CONFIG_BACKUP.s()); + log(Captions.LEGACY_CONFIG_BACKUP.getTranslated()); final ConfigurationSection worlds = this.worlds.getConfigurationSection("worlds"); final LegacyConverter converter = new LegacyConverter(worlds); @@ -1691,9 +1674,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(Captions.LEGACY_CONFIG_DONE.s()); + log(Captions.LEGACY_CONFIG_DONE.getTranslated()); } catch (final Exception e) { - log(Captions.LEGACY_CONFIG_CONVERSION_FAILED.s()); + log(Captions.LEGACY_CONFIG_CONVERSION_FAILED.getTranslated()); e.printStackTrace(); } // Disable plugin 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 8e0847f57..7f335cfa5 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 @@ -101,13 +101,14 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; return false; } plot.setAlias(alias); - MainUtil.sendMessage(player, Captions.ALIAS_SET_TO.s().replaceAll("%alias%", alias)); + MainUtil.sendMessage(player, + Captions.ALIAS_SET_TO.getTranslated().replaceAll("%alias%", alias)); return true; } private boolean removeAlias(PlotPlayer player, Plot plot) { plot.setAlias(null); - MainUtil.sendMessage(player, Captions.ALIAS_REMOVED.s()); + MainUtil.sendMessage(player, Captions.ALIAS_REMOVED.getTranslated()); return true; } 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 ed6a4a3dc..f4c73a972 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 @@ -331,8 +331,8 @@ import java.util.Set; + "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + "\n$1Region: $2" + region + "\n$1Generator: $2" + generator; MainUtil.sendMessage(player, - Captions.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER - .s(), false); + Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n' + + Captions.PLOT_INFO_FOOTER.getTranslated(), false); return true; } case "l": @@ -394,7 +394,7 @@ import java.util.Set; .color("$1").text(" - ").color("$2") .text(area.TYPE + ":" + area.TERRAIN).color("$3"); } - }, "/plot area list", Captions.AREA_LIST_HEADER_PAGED.s()); + }, "/plot area list", Captions.AREA_LIST_HEADER_PAGED.getTranslated()); return true; case "regen": case "clear": 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 b40167b4c..487c5d7c0 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 @@ -16,10 +16,11 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; @Override public boolean set(final PlotPlayer player, final Plot plot, final String value) { int biome = WorldUtil.IMP.getBiomeFromString(value); if (biome == -1) { - String biomes = - StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s()); + String biomes = StringMan + .join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.getTranslated()); Captions.NEED_BIOME.send(player); - MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); + MainUtil.sendMessage(player, + Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes); return false; } if (plot.getRunning() > 0) { @@ -29,7 +30,8 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; plot.addRunning(); plot.setBiome(value.toUpperCase(), () -> { plot.removeRunning(); - MainUtil.sendMessage(player, Captions.BIOME_SET_TO.s() + value.toLowerCase()); + MainUtil + .sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase()); }); return true; } 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 32d7095a9..1bc8f779e 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 @@ -297,7 +297,8 @@ import java.util.UUID; Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea())); + Captions.PERMISSION_CLUSTER.getTranslated() + "." + (current + cluster + .getArea())); return false; } // resize cluster @@ -588,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 = Captions.CLUSTER_INFO.s(); + String message = Captions.CLUSTER_INFO.getTranslated(); message = message.replaceAll("%id%", id); message = message.replaceAll("%owner%", owner); message = message.replaceAll("%name%", name); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java index bebf77907..3958f2d39 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java @@ -16,7 +16,7 @@ import lombok.RequiredArgsConstructor; * Teleportation CommandConfig. * Such as: /plot visit */ - TELEPORT(Captions.COMMAND_CATEGORY_TELEPPORT), + TELEPORT(Captions.COMMAND_CATEGORY_TELEPORT), /** * Protection. */ @@ -53,6 +53,6 @@ import lombok.RequiredArgsConstructor; private final Captions caption; @Override public String toString() { - return this.caption.s(); + return this.caption.getTranslated(); } } 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 dd95a8c2f..2a34fdbf5 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 @@ -19,7 +19,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } 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 527b67819..fdc44e5c7 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 @@ -15,15 +15,15 @@ public class Debug extends SubCommand { if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { StringBuilder msg = new StringBuilder(); for (Captions caption : Captions.values()) { - msg.append(caption.s()).append("\n"); + msg.append(caption.getTranslated()).append("\n"); } MainUtil.sendMessage(player, msg.toString()); return true; } StringBuilder information = new StringBuilder(); - String header = Captions.DEBUG_HEADER.s(); - String line = Captions.DEBUG_LINE.s(); - String section = Captions.DEBUG_SECTION.s(); + String header = Captions.DEBUG_HEADER.getTranslated(); + String line = Captions.DEBUG_LINE.getTranslated(); + String section = Captions.DEBUG_SECTION.getTranslated(); information.append(header); information.append(getSection(section, "PlotArea")); information.append( 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 ba4e1b4ff..e9471e6e7 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 @@ -124,8 +124,8 @@ import java.util.stream.Collectors; final String pasteId = jsonObject.get("paste_id").getAsString(); final String link = String.format("https://athion.net/ISPaster/paste/view/%s", pasteId); - player - .sendMessage(Captions.DEBUG_REPORT_CREATED.s().replace("%url%", link)); + player.sendMessage( + Captions.DEBUG_REPORT_CREATED.getTranslated().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/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index fa6a1f96c..7bb0ab34a 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 @@ -105,7 +105,7 @@ import java.util.UUID; 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(Captions.YOU_GOT_DENIED.s()); + player.kick(Captions.YOU_GOT_DENIED.getTranslated()); } else { player.teleport(newSpawn); } 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 43560b81f..14521b2c6 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 @@ -8,7 +8,11 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.MainUtil; +import com.github.intellectualsites.plotsquared.plot.util.Permissions; +import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; +import com.github.intellectualsites.plotsquared.plot.util.StringMan; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.sk89q.jnbt.CompoundTag; import java.net.URL; @@ -37,7 +41,7 @@ import java.net.URL; return false; } if ((!plot.isOwner(player.getUUID())) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); 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 83161d73a..7a1d2cddc 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 @@ -142,7 +142,7 @@ public class GenerateDocs { Matcher m2 = p2.matcher(line); while (m2.find()) { - perms.add(Captions.valueOf("PERMISSION_" + m2.group(1)).s()); + perms.add(Captions.valueOf("PERMISSION_" + m2.group(1)).getTranslated()); } 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 = Captions.valueOf(perm.split("\\.")[1]).s(); + perm = Captions.valueOf(perm.split("\\.")[1]).getTranslated(); } else { continue; } @@ -181,7 +181,7 @@ public class GenerateDocs { String perm = method.split("[,|)]")[1].trim(); if (!perm.equalsIgnoreCase(perm)) { if (perm.startsWith("C.")) { - perm = Captions.valueOf(perm.split("\\.")[1]).s(); + perm = Captions.valueOf(perm.split("\\.")[1]).getTranslated(); } else { continue; } 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 0a5515370..47d9ea89b 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 @@ -77,16 +77,17 @@ public class Help extends Command { } if (cat == null && page == 0) { StringBuilder builder = new StringBuilder(); - builder.append(Captions.HELP_HEADER.s()); + builder.append(Captions.HELP_HEADER.getTranslated()); for (CommandCategory c : CommandCategory.values()) { builder.append("\n").append(StringMan - .replaceAll(Captions.HELP_INFO_ITEM.s(), "%category%", c.toString().toLowerCase(), + .replaceAll(Captions.HELP_INFO_ITEM.getTranslated(), "%category%", + c.toString().toLowerCase(), "%category_desc%", c.toString())); } builder.append("\n") - .append(Captions.HELP_INFO_ITEM.s().replaceAll("%category%", "all") + .append(Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all") .replaceAll("%category_desc%", "Display all commands")); - builder.append("\n").append(Captions.HELP_FOOTER.s()); + builder.append("\n").append(Captions.HELP_FOOTER.getTranslated()); MainUtil.sendMessage(player, builder.toString(), false); return true; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 4a59850a9..8d427bbcd 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 @@ -40,7 +40,8 @@ import java.util.List; } StringBuilder string = new StringBuilder(); string.append(StringMan - .replaceAll(Captions.COMMENT_LIST_HEADER_PAGED.s(), "%amount%", comments.length, "%cur", + .replaceAll(Captions.COMMENT_LIST_HEADER_PAGED.getTranslated(), "%amount%", + comments.length, "%cur", page + 1, "%max", totalPages + 1, "%word", "all") + '\n'); // This might work xD 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 51e5cd6c0..fe42e5dd4 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 @@ -5,7 +5,11 @@ 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; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotInventory; +import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.RunnableVal; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; @@ -53,7 +57,7 @@ public class Info extends SubCommand { plot = player.getCurrentPlot(); } if (plot == null) { - MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.s()); + MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.getTranslated()); return false; } @@ -70,7 +74,8 @@ public class Info extends SubCommand { boolean allowed = false; for (final String argument : args) { if (argument.equalsIgnoreCase("-f")) { - if (!player.hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.s())) { + if (!player + .hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())) { Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_INFO_FORCE); return true; } @@ -125,7 +130,7 @@ public class Info extends SubCommand { plot.getId().x + ";" + plot.getId().y); return true; } - String info = Captions.PLOT_INFO.s(); + String info = Captions.PLOT_INFO.getTranslated(); boolean full; if (arg != null) { info = getCaption(arg); @@ -148,8 +153,8 @@ public class Info extends SubCommand { MainUtil.format(info, plot, player, full, new RunnableVal() { @Override public void run(String value) { MainUtil.sendMessage(player, - Captions.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + Captions.PLOT_INFO_FOOTER - .s(), false); + Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n' + + Captions.PLOT_INFO_FOOTER.getTranslated(), false); } }); return true; @@ -158,29 +163,29 @@ public class Info extends SubCommand { private String getCaption(String string) { switch (string) { case "trusted": - return Captions.PLOT_INFO_TRUSTED.s(); + return Captions.PLOT_INFO_TRUSTED.getTranslated(); case "alias": - return Captions.PLOT_INFO_ALIAS.s(); + return Captions.PLOT_INFO_ALIAS.getTranslated(); case "biome": - return Captions.PLOT_INFO_BIOME.s(); + return Captions.PLOT_INFO_BIOME.getTranslated(); case "denied": - return Captions.PLOT_INFO_DENIED.s(); + return Captions.PLOT_INFO_DENIED.getTranslated(); case "flags": - return Captions.PLOT_INFO_FLAGS.s(); + return Captions.PLOT_INFO_FLAGS.getTranslated(); case "id": - return Captions.PLOT_INFO_ID.s(); + return Captions.PLOT_INFO_ID.getTranslated(); case "size": - return Captions.PLOT_INFO_SIZE.s(); + return Captions.PLOT_INFO_SIZE.getTranslated(); case "members": - return Captions.PLOT_INFO_MEMBERS.s(); + return Captions.PLOT_INFO_MEMBERS.getTranslated(); case "owner": - return Captions.PLOT_INFO_OWNER.s(); + return Captions.PLOT_INFO_OWNER.getTranslated(); case "rating": - return Captions.PLOT_INFO_RATING.s(); + return Captions.PLOT_INFO_RATING.getTranslated(); case "likes": - return Captions.PLOT_INFO_LIKES.s(); + return Captions.PLOT_INFO_LIKES.getTranslated(); case "seen": - return Captions.PLOT_INFO_SEEN.s(); + return Captions.PLOT_INFO_SEEN.getTranslated(); 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 b749eaba4..2ffb6aa6a 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 @@ -79,7 +79,7 @@ import java.util.UUID; .getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn - player2.kick(Captions.YOU_GOT_KICKED.s()); + player2.kick(Captions.YOU_GOT_KICKED.getTranslated()); } else { player2.plotkick(newSpawn); } 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 33957d617..4917e2499 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 @@ -72,8 +72,8 @@ public class ListCmd extends SubCommand { } public void noArgs(PlotPlayer player) { - MainUtil.sendMessage(player, - Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(player))); + MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + Arrays + .toString(getArgumentList(player))); } @Override public boolean onCommand(PlotPlayer player, String[] args) { @@ -367,19 +367,19 @@ public class ListCmd extends SubCommand { color = "$1"; } PlotMessage trusted = new PlotMessage().text(Captions.color( - Captions.PLOT_INFO_TRUSTED.s() + Captions.PLOT_INFO_TRUSTED.getTranslated() .replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted())))) .color("$1"); PlotMessage members = new PlotMessage().text(Captions.color( - Captions.PLOT_INFO_MEMBERS.s() + Captions.PLOT_INFO_MEMBERS.getTranslated() .replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers())))) .color("$1"); String strFlags = StringMan.join(plot.getFlags().values(), ","); if (strFlags.isEmpty()) { - strFlags = Captions.NONE.s(); + strFlags = Captions.NONE.getTranslated(); } - PlotMessage flags = new PlotMessage().text(Captions - .color(Captions.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))) + PlotMessage flags = new PlotMessage().text(Captions.color( + Captions.PLOT_INFO_FLAGS.getTranslated().replaceAll("%flags%", strFlags))) .color("$1"); message.text("[").color("$3").text(i + "") .command("/plot visit " + plot.getArea() + ";" + plot.getId()) @@ -407,7 +407,7 @@ public class ListCmd extends SubCommand { prefix = ", "; } } - }, "/plot list " + args[0], Captions.PLOT_LIST_HEADER_PAGED.s()); + }, "/plot list " + args[0], Captions.PLOT_LIST_HEADER_PAGED.getTranslated()); } } 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 2e68b739c..fcf5650b2 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 @@ -107,7 +107,7 @@ public class Merge extends SubCommand { if (!terrain && !Permissions .hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_MERGE_KEEP_ROAD.s()); + Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); return true; } if (plot.autoMerge(-1, maxSize, uuid, terrain)) { @@ -133,7 +133,7 @@ public class Merge extends SubCommand { MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); MainUtil.sendMessage(player, - Captions.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw()))); + Captions.DIRECTION.getTranslated().replaceAll("%dir%", direction(loc.getYaw()))); return false; } final boolean terrain; @@ -144,7 +144,7 @@ public class Merge extends SubCommand { } if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { MainUtil.sendMessage(player, Captions.NO_PERMISSION, - Captions.PERMISSION_MERGE_KEEP_ROAD.s()); + Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); return true; } if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) { @@ -193,8 +193,8 @@ public class Merge extends SubCommand { MainUtil.sendMessage(player, Captions.SUCCESS_MERGE); }; if (hasConfirmation(player)) { - CmdConfirm.addPending(accepter, - Captions.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", player.getName()), run); + CmdConfirm.addPending(accepter, Captions.MERGE_REQUEST_CONFIRM.getTranslated() + .replaceAll("%s", player.getName()), run); } else { run.run(); } 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 e52ec1fcf..0e6d78247 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 @@ -21,7 +21,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } @@ -50,7 +50,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; return false; } if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s()))) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated()))) { Captions.PLOTWORLD_INCOMPATIBLE.send(player); return false; } 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 8247c0e83..55dbdbda4 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 @@ -37,8 +37,8 @@ import java.util.UUID; if (uuid == null || value.equalsIgnoreCase("-")) { if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value .equalsIgnoreCase("-")) { - if (!Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER.s(), true)) { + if (!Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER.getTranslated(), true)) { return false; } Set connected = plot.getConnectedPlots(); 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 7b01f57e1..982e03ae1 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 @@ -126,7 +126,8 @@ import java.util.stream.IntStream; newValues.addAll( Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); } - MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan + MainUtil + .sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + StringMan .join(newValues, Captions.BLOCK_LIST_SEPARATER.formatted())); return false; } 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 da709d2a3..9f7f0b145 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 @@ -19,7 +19,7 @@ public class Swap extends SubCommand { return !MainUtil.sendMessage(player, Captions.NOT_IN_PLOT); } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.s())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index a606b5a3a..5fd74a9ea 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -21,9 +21,7 @@ import java.util.Set; public enum Captions { //@formatter:off - /* - * Static flags - */ + // FLAG_USE("use", "static.flags"), FLAG_BREAK("break", "static.flags"), FLAG_PLACE("place", "static.flags"), @@ -44,9 +42,8 @@ public enum Captions { FLAG_TAMED_INTERACT("tamed-interact", "static.flags"), FLAG_DISABLE_PHYSICS("disable-physics", "static.flags"), FLAG_MOB_PLACE("mob-place", "static.flags"), - /* - * Static permission - */ + // + // PERMISSION_STAR("*", "static.permissions"), PERMISSION_ADMIN("plots.admin", "static.permissions"), PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned", "static.permissions"), @@ -162,37 +159,32 @@ public enum Captions { PERMISSION_ALIAS_SET_OBSOLETE("plots.set.alias", "static.permissions"), // Note this is for backwards compatibility PERMISSION_ALIAS_SET("plots.alias.set", "static.permissions"), PERMISSION_ALIAS_REMOVE("plots.alias.remove", "static.permissions"), - /* - * Static console - */ + // + // CONSOLE_JAVA_OUTDATED( "&cYour version of java is outdated. It is highly recommended that you update to Java 8 as it increases performance " + "and security. %s0 will require Java 8 in a future update.", "static.console"), CONSOLE_PLEASE_ENABLE_METRICS( "&dPlease enable metrics for %s0. Using metrics improves plugin stability, performance, and features. " + "Bug fixes and new features are influenced on metrics.", "static.console"), - /* - * Confirm - */ + // + // EXPIRED_CONFIRM("$2Confirmation has expired, please run the command again!", "Confirm"), FAILED_CONFIRM("$2You have no pending actions to confirm!", "Confirm"), REQUIRES_CONFIRM( "$2Are you sure you wish to execute: $1%s$2?&-$2This cannot be undone! If you are sure: $1/plot confirm", "Confirm"), - /* - * Move - */ + // + // MOVE_SUCCESS("$4Successfully moved plot.", "Move"), COPY_SUCCESS("$4Successfully copied plot.", "Move"), REQUIRES_UNOWNED("$2The location specified is already occupied.", "Move"), - /* - * Area Create - */ + // + // REQUIRES_UNMERGED("$2The plot cannot be merged", "debug"), SET_ATTRIBUTE("$4Successfully set %s0 set to %s1", "Set"), - /* - * Web - */ + // + // GENERATING_LINK("$1Processing plot...", "Web"), GENERATING_LINK_FAILED( "$2Failed to generate download link!", "Web"), @@ -201,13 +193,11 @@ public enum Captions { LOAD_FAILED("$2Failed to load schematic", "Web"), LOAD_LIST("$2To load a schematic, use $1/plot load #", "Web"), SAVE_SUCCESS("$1Successfully saved!", "Web"), - /* - * Compass - */ + // + // COMPASS_TARGET("$4Successfully targeted plot with compass", "Compass"), - /* - * Cluster - */ + // + // CLUSTER_AVAILABLE_ARGS( "$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, " + "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_LIST_HEADING( @@ -233,18 +223,15 @@ public enum Captions { CLUSTER_INFO( "$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%", "Cluster"), - /* - * Border - */ + // + // BORDER("$2You are outside the current map border", "Border"), - /* - * Un-claim - */ + // + // UNCLAIM_SUCCESS("$4You successfully unclaimed the plot.", "Unclaim"), UNCLAIM_FAILED( "$2Could not unclaim the plot", "Unclaim"), - /* - * WorldEdit masks - */ + // + // WORLDEDIT_DELAYED("$2Please wait while we process your WorldEdit action...", "WorldEdit Masks"), WORLDEDIT_RUN("$2Apologies for the delay. Now executing: %s", "WorldEdit Masks"), @@ -270,25 +257,20 @@ public enum Captions { GAMEMODE_WAS_BYPASSED("$1You bypassed the GameMode ($2{gamemode}$1) $1set for $2{plot}", "GameMode"), HEIGHT_LIMIT("$1This plot area has a height limit of $2{limit}", "Height Limit"), - /* - * Records - */ - RECORD_PLAY("$2%player $2started playing record $1%name", "Records"), NOTIFY_ENTER( - "$2%player $2entered your plot ($1%plot$2)", "Records"), - + // + // + NOTIFY_ENTER("$2%player $2entered your plot ($1%plot$2)", "Records"), NOTIFY_LEAVE("$2%player $2left your plot ($1%plot$2)", "Records"), - /* - * Swap - */ + // + // SWAP_OVERLAP("$2The proposed areas are not allowed to overlap", "Swap"), SWAP_DIMENSIONS( "$2The proposed areas must have comparable dimensions", "Swap"), SWAP_SYNTAX("$2/plot swap ", "Swap"), SWAP_SUCCESS("$4Successfully swapped plots", "Swap"), STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"), - /* - * Comment - */ + // + // INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"), NOT_VALID_INBOX_INDEX( "$2No comment at index %s", "Comment"), @@ -306,21 +288,18 @@ public enum Captions { COMMENT_HEADER("$2&m---------&r $1Comments $2&m---------&r", "Comment"), INBOX_EMPTY( "$2No comments", "Comment"), - /* - * Console - */ + // + // NOT_CONSOLE("$2For safety reasons, this command can only be executed by console.", "Console"), IS_CONSOLE("$2This command can only be executed by a player.", "Console"), - /* - Inventory - */ + // + // INVENTORY_USAGE("&cUsage: &6{usage}", "Inventory"), INVENTORY_DESC("&cDescription: &6{desc}", "Inventory"), INVENTORY_CATEGORY("&cCategory: &6{category}", "Inventory"), - /* - * Clipboard - */ + // + // CLIPBOARD_SET( "$2The current plot is now copied to your clipboard, use $1/plot paste$2 to paste it", "Clipboard"), PASTED( @@ -333,16 +312,15 @@ public enum Captions { CLIPBOARD_INFO( "$2Current Selection - Plot ID: $1%id$2, Width: $1%width$2, Total Blocks: $1%total$2", "Clipboard"), - /* - * Toggle - */ + // + // TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"), TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"), COMMAND_BLOCKED("$2That command is not allowed in this plot", "Blocked Command"), - /* - * Done - */ + // + // + DONE_ALREADY_DONE("$2This plot is already marked as done", "Done"), DONE_NOT_DONE( "$2This plot is not marked as done.", "Done"), @@ -351,10 +329,8 @@ public enum Captions { "Done"), DONE_SUCCESS("$1Successfully marked this plot as done.", "Done"), DONE_REMOVED("$1You may now continue building in this plot.", "Done"), - /* - * Ratings - */ - + // + // RATINGS_PURGED("$2Purged ratings for this plot", "Ratings"), RATING_NOT_VALID( "$2You need to specify a number between 1 and 10", "Ratings"), @@ -368,16 +344,12 @@ public enum Captions { "$2You can only rate finished plots.", "Ratings"), RATING_NOT_OWNED("$2You cannot rate a plot that is not claimed by anyone", "Ratings"), - /* - * Tutorial - */ - + // + // RATE_THIS("$2Rate this plot!", "Tutorial"), COMMENT_THIS( "$2Leave some feedback on this plot: %s", "Tutorial"), - /* - * Economy Stuff - */ - + // + // ECON_DISABLED("$2Economy is not enabled", "Economy"), CANNOT_AFFORD_PLOT( "$2You cannot afford to buy this plot. It costs $1%s", "Economy"), @@ -392,10 +364,8 @@ public enum Captions { "$1%s $2has been taken from your balance", "Economy"), REMOVED_GRANTED_PLOT("$2You used %s plot grant(s), you've got $1%s $2left", "Economy"), - /* - * Setup Stuff - */ - + // + // SETUP_INIT("$1Usage: $2/plot setup ", "Setup"), SETUP_STEP( "$3[$1Step %s0$3] $1%s1 $2- $1Expecting: $2%s2 $1Default: $2%s3", "Setup"), @@ -415,9 +385,8 @@ public enum Captions { + "$1/plot setup back&-$2 - $1/plot setup cancel", "Setup"), SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"), - /* - * Schematic Stuff - */ + // + // SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"), SCHEMATIC_MISSING_ARG( @@ -431,38 +400,29 @@ public enum Captions { "Schematics"), SCHEMATIC_PASTE_SUCCESS("$4The schematic pasted successfully", "Schematics"), SCHEMATIC_LIST("$4Saved Schematics: $1%s", "Schematics"), - - /* - * Title Stuff - */ - TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"), TITLE_ENTERED_PLOT_SUB("$4Owned by %s", - "Titles"), - - PREFIX_GREETING("$1%id%$2> ", "Titles"), PREFIX_FAREWELL("$1%id%$2> ", "Titles"), - /* - * Core Stuff - */ - - TASK_START("Starting task...", "Core"), PREFIX("$3[$1P2$3] $2", "Core"), - + // + // + TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"), + TITLE_ENTERED_PLOT_SUB("$4Owned by %s", "Titles"), + PREFIX_GREETING("$1%id%$2> ", "Titles"), + PREFIX_FAREWELL("$1%id%$2> ", "Titles"), + // + // + TASK_START("Starting task...", "Core"), + PREFIX("$3[$1P2$3] $2", "Core"), ENABLED("$1%s0 is now enabled", "Core"), - /* - * Reload - */ - - RELOADED_CONFIGS("$1Translations and world settings have been reloaded", - "Reload"), RELOAD_FAILED("$2Failed to reload file configurations", "Reload"), - /* - * BarAPI - */ - - DESC_SET("$2Plot description set", "Desc"), DESC_UNSET("$2Plot description unset", "Desc"), - + // + // + RELOADED_CONFIGS("$1Translations and world settings have been reloaded", "Reload"), + RELOAD_FAILED("$2Failed to reload file configurations", "Reload"), + // + // + DESC_SET("$2Plot description set", "Desc"), + DESC_UNSET("$2Plot description unset", "Desc"), MISSING_DESC("$2You need to specify a description", "Desc"), + // + // - /* - * Alias - */ ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), ALIAS_REMOVED("$2Plot alias removed", "Alias"), @@ -470,9 +430,8 @@ public enum Captions { "$2The alias must be < 50 characters in length", "Alias"), ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"), - /* - * Position - */ + // + // MISSING_POSITION("$2You need to specify a position. Possible values: $1none", "Position"), POSITION_SET("$1Home position set to your current location", "Position"), @@ -481,38 +440,25 @@ public enum Captions { "$2Use /plot set home [none]", "Position"), INVALID_POSITION("$2That is not a valid position value", "Position"), - /* - * Cap - */ - + // + // ENTITY_CAP("$2You are not allowed to spawn more mobs", "cap"), - /* - * Time - */ - - TIME_FORMAT("$1%hours%, %min%, %sec%", "Time"), - /* - * Permission - */ - + // + // NO_SCHEMATIC_PERMISSION("$2You don't have the permission required to use schematic $1%s", - "Permission"), NO_PERMISSION("$2You are lacking the permission node: $1%s", "Permission"), - - NO_PERMISSION_EVENT("$2You are lacking the permission node: $1%s", "Permission"), NO_PLOT_PERMS( - "$2You must be the plot owner to perform this action", "Permission"), - - CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots.", "Permission"), CANT_CLAIM_MORE_CLUSTERS( - "$2You can't claim more clusters.", "Permission"), + "Permission"), + NO_PERMISSION("$2You are lacking the permission node: $1%s", "Permission"), + NO_PERMISSION_EVENT("$2You are lacking the permission node: $1%s", "Permission"), + NO_PLOT_PERMS("$2You must be the plot owner to perform this action", "Permission"), + CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots.", "Permission"), + CANT_CLAIM_MORE_CLUSTERS("$2You can't claim more clusters.", "Permission"), CANT_TRANSFER_MORE_PLOTS("$2You can't send more plots to that user", "Permission"), CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once", "Permission"), - YOU_BE_DENIED("$2You are not allowed to enter this plot", "Permission"), - - /* - * Merge - */ + // + // MERGE_NOT_VALID("$2This merge request is no longer valid.", "Merge"), MERGE_ACCEPTED( "$2The merge request has been accepted", "Merge"), @@ -528,10 +474,8 @@ public enum Captions { UNLINK_IMPOSSIBLE("$2You can only unlink a mega-plot", "Merge"), UNLINK_SUCCESS( "$2Successfully unlinked plots.", "Merge"), - /* - * CommandConfig - */ - + // + // NOT_VALID_SUBCOMMAND("$2That is not a valid subcommand", "CommandConfig"), DID_YOU_MEAN( "$2Did you mean: $1%s", "CommandConfig"), @@ -540,100 +484,69 @@ public enum Captions { SUBCOMMAND_SET_OPTIONS_HEADER("$2Possible Values: ", "CommandConfig"), COMMAND_SYNTAX( "$1Usage: $2%s", "CommandConfig"), - /* - * Player not found - */ - - INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", - "Errors"), INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"), - + // + // + INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"), + INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"), INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"), - /* - * Command flag - */ - - INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"), /* - * Unknown Error - */ - - ERROR("$2An error occurred: %s", - "Errors"), // SETTINGS_PASTE_UPLOADED("$2settings.yml was uploaded to: $1%url%", "Paste"), - - // LATEST_LOG_UPLOADED("$2latest.log was uploaded to: $1%url%", "Paste"), + INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"), + ERROR("$2An error occurred: %s", "Errors"), + COMMAND_WENT_WRONG("$2Something went wrong when executing that command...", "Errors"), + NO_FREE_PLOTS("$2There are no free plots available", "Errors"), + NOT_IN_PLOT("$2You're not in a plot", "Errors"), + NOT_LOADED("$2The plot could not be loaded", "Errors"), + NOT_IN_CLUSTER( + "$2You must be within a plot cluster to perform that action", "Errors"), + NOT_IN_PLOT_WORLD("$2You're not in a plot area", "Errors"), + PLOTWORLD_INCOMPATIBLE("$2The two worlds must be compatible", "Errors"), + NOT_VALID_WORLD("$2That is not a valid world (case sensitive)", "Errors"), + NOT_VALID_PLOT_WORLD("$2That is not a valid plot area (case sensitive)", "Errors"), + NO_PLOTS("$2You don't have any plots", "Errors"), + WAIT_FOR_TIMER( + "$2A set block timer is bound to either the current plot or you. Please wait for it to finish", + "Errors"), + // DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"), - COMMAND_WENT_WRONG("$2Something went wrong when executing that command...", "Errors"), - /* - * purge - */ - PURGE_SUCCESS("$4Successfully purged %s plots", "Purge"), - /* - * trim - */ - TRIM_IN_PROGRESS("A world trim task is already in progress!", - "Trim"), NOT_VALID_HYBRID_PLOT_WORLD( - "The hybrid plot manager is required to perform this action", "Trim"), - /* - * No - */ - - NO_FREE_PLOTS("$2There are no free plots available", "Errors"), NOT_IN_PLOT( - "$2You're not in a plot", "Errors"), - - NOT_LOADED("$2The plot could not be loaded", "Errors"), NOT_IN_CLUSTER( - "$2You must be within a plot cluster to perform that action", "Errors"), - - NOT_IN_PLOT_WORLD("$2You're not in a plot area", "Errors"), PLOTWORLD_INCOMPATIBLE( - "$2The two worlds must be compatible", "Errors"), - - NOT_VALID_WORLD("$2That is not a valid world (case sensitive)", "Errors"), NOT_VALID_PLOT_WORLD( - "$2That is not a valid plot area (case sensitive)", "Errors"), - - NO_PLOTS("$2You don't have any plots", "Errors"), - /* - * Block List - */ + // + TRIM_IN_PROGRESS("A world trim task is already in progress!", "Trim"), + NOT_VALID_HYBRID_PLOT_WORLD("The hybrid plot manager is required to perform this action", "Trim"), + // + // BLOCK_LIST_SEPARATER("$1,$2 ", "Block List"), - /* - * Biome - */ + // + // NEED_BIOME("$2You need to specify a valid biome.", "Biome"), BIOME_SET_TO( "$2Plot biome set to $2", "Biome"), - /* - * Teleport / Entry - */ + // + // TELEPORTED_TO_PLOT("$1You have been teleported", "Teleport"), TELEPORTED_TO_ROAD( "$2You got teleported to the road", "Teleport"), TELEPORT_IN_SECONDS("$1Teleporting in %s seconds. Do not move...", "Teleport"), TELEPORT_FAILED( "$2Teleportation cancelled due to movement or damage", "Teleport"), - /* - * Set Block - */ + // + // SET_BLOCK_ACTION_FINISHED("$1The last setblock action is now finished.", "Set Block"), + // + // - /* - AllowUnsafe - */ DEBUGALLOWUNSAFE_ON("$2Unsafe actions allowed", "unsafe"), DEBUGALLOWUNSAFE_OFF( "$2Unsafe actions disabled", "unsafe"), - /* - * Debug - */ + // + // DEBUG_HEADER("$1Debug Information&-", "Debug"), DEBUG_SECTION("$2>> $1&l%val%", "Debug"), DEBUG_LINE("$2>> $1%var%$2:$1 %val%&-", "Debug"), - - /* - * Invalid - */ + // + // NOT_VALID_DATA("$2That's not a valid data id.", "Invalid"), NOT_VALID_BLOCK( "$2That's not a valid block: %s", "Invalid"), @@ -651,30 +564,26 @@ public enum Captions { "$2Found no plots with your search query", "Invalid"), FOUND_NO_PLOTS_FOR_PLAYER("$2No plots found for player: %s", "Invalid"), - /* - * Need - */ - NEED_PLOT_NUMBER("$2You've got to specify a plot number or alias", "Need"), NEED_BLOCK( - "$2You've got to specify a block", "Need"), - - NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"), NEED_PLOT_WORLD( - "$2You've got to specify a plot area.", "Need"), - + // + // + NEED_PLOT_NUMBER("$2You've got to specify a plot number or alias", "Need"), + NEED_BLOCK("$2You've got to specify a block", "Need"), + NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"), + NEED_PLOT_WORLD("$2You've got to specify a plot area.", "Need"), NEED_USER("$2You need to specify a username", "Need"), - /* - * Near - */ + // + // PLOT_NEAR("$1Players: %s0", "Near"), - /* - * Info - */ + // + // NONE("None", "Info"), NOW("Now", "Info"), NEVER("Never", "Info"), UNKNOWN("Unknown", "Info"), SERVER("Server", "Info"), - EVERYONE("Everyone", "Info"), PLOT_UNOWNED( + EVERYONE("Everyone", "Info"), + PLOT_UNOWNED( "$2The current plot must have an owner to perform this action", "Info"), PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), PLOT_INFO_HEADER( @@ -685,11 +594,12 @@ public enum Captions { PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner: $2%owner%$1&-" + "$1Biome: $2%biome%$1&-" + "$1Can Build: $2%build%$1&-" + "$1Rating: $2%rating%&-" + "$1Seen: $2%seen%&-" + "$1Trusted: $2%trusted%$1&-" + "$1Members: $2%members%$1&-" - + "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"), PLOT_INFO_FOOTER( + + "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"), + PLOT_INFO_FOOTER( "$3&m---------&r $1INFO $3&m---------", false, "Info"), - PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), PLOT_INFO_MEMBERS("$1Members:$2 %members%", - "Info"), + PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), + PLOT_INFO_MEMBERS("$1Members:$2 %members%", "Info"), PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"), PLOT_INFO_FLAGS("$1Flags:$2 %flags%", "Info"), @@ -704,195 +614,116 @@ public enum Captions { PLOT_INFO_SEEN("$1Seen:$2 %seen%", "Info"), PLOT_USER_LIST(" $1%user%$2,", "Info"), PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"), INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"), - /* - * Generating - */ - + // + // GENERATING_COMPONENT("$1Started generating component from your settings", "Working"), - /* - * Clearing - */ - - CLEARING_PLOT("$2Clearing plot async.", "Working"), CLEARING_DONE( - "$4Clear completed! Took %sms.", "Working"), - + CLEARING_PLOT("$2Clearing plot async.", "Working"), + CLEARING_DONE("$4Clear completed! Took %sms.", "Working"), DELETING_DONE("$4Delete completed! Took %sms.", "Working"), - /* - * Claiming - */ - - PLOT_NOT_CLAIMED("$2Plot not claimed", "Working"), PLOT_IS_CLAIMED( - "$2This plot is already claimed", "Working"), - + PLOT_NOT_CLAIMED("$2Plot not claimed", "Working"), + PLOT_IS_CLAIMED("$2This plot is already claimed", "Working"), CLAIMED("$4You successfully claimed the plot", "Working"), - /* - * List - */ - - COMMENT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% comments", - "List"), CLICKABLE(" (interactive)", "List"), - - AREA_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% areas", - "List"), PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", - "List"), - - PLOT_LIST_HEADER("$1List of %word% plots", "List"), PLOT_LIST_ITEM( - "$2>> $1%id$2:$1%world $2- $1%owner", "List"), - - PLOT_LIST_ITEM_ORDERED("$2[$1%in$2] >> $1%id$2:$1%world $2- $1%owner", - "List"), PLOT_LIST_FOOTER("$2>> $1%word% a total of $2%num% $1claimed %plot%.", "List"), - /* - * Left - */ - - LEFT_PLOT("$2You left a plot", "Left"), - /* - * Wait - */ - - WAIT_FOR_TIMER( - "$2A setblock timer is bound to either the current plot or you. Please wait for it to finish", - "Errors"), - /* - * Chat - */ - - PLOT_CHAT_SPY_FORMAT("$2[$1Plot Spy$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", - "Chat"), PLOT_CHAT_FORMAT("$2[$1Plot Chat$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", "Chat"), - - PLOT_CHAT_FORCED("$2This world forces everyone to use plot chat.", "Chat"), PLOT_CHAT_ON( - "$4Plot chat enabled.", "Chat"), - + // + // + COMMENT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% comments", "List"), + CLICKABLE(" (interactive)", "List"), + AREA_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% areas", "List"), + PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", "List"), + PLOT_LIST_HEADER("$1List of %word% plots", "List"), + PLOT_LIST_ITEM("$2>> $1%id$2:$1%world $2- $1%owner", "List"), + PLOT_LIST_ITEM_ORDERED("$2[$1%in$2] >> $1%id$2:$1%world $2- $1%owner", "List"), + PLOT_LIST_FOOTER("$2>> $1%word% a total of $2%num% $1claimed %plot%.", "List"), + // + // + PLOT_CHAT_SPY_FORMAT("$2[$1Plot Spy$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", "Chat"), + PLOT_CHAT_FORMAT("$2[$1Plot Chat$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", "Chat"), + PLOT_CHAT_FORCED("$2This world forces everyone to use plot chat.", "Chat"), + PLOT_CHAT_ON("$4Plot chat enabled.", "Chat"), PLOT_CHAT_OFF("$4Plot chat disabled.", "Chat"), - /* - * Denied - */ - - DENIED_REMOVED("$4You successfully undenied the player from this plot", "Deny"), DENIED_ADDED( - "$4You successfully denied the player from this plot", "Deny"), - - DENIED_NEED_ARGUMENT( - "$2Arguments are missing. $1/plot denied add $2or $1/plot denied remove ", - "Deny"), WAS_NOT_DENIED("$2That player was not denied on this plot", "Deny"), - - YOU_GOT_DENIED( - "$4You are denied from the plot you were previously on, and got teleported to spawn", - "Deny"), - /* - * Kick - */ - + // + // + DENIED_REMOVED("$4You successfully undenied the player from this plot", "Deny"), + DENIED_ADDED("$4You successfully denied the player from this plot", "Deny"), + DENIED_NEED_ARGUMENT("$2Arguments are missing. $1/plot denied add $2or $1/plot denied remove ", "Deny"), + WAS_NOT_DENIED("$2That player was not denied on this plot", "Deny"), + YOU_GOT_DENIED("$4You are denied from the plot you were previously on, and got teleported to spawn", "Deny"), + // YOU_GOT_KICKED("$4You got kicked!", "Kick"), - /* - * Rain - */ + // + FLAG_KEY("$2Key: %s", "Flag"), + FLAG_TYPE("$2Type: %s", "Flag"), + FLAG_DESC("$2Desc: %s", "Flag"), + NOT_VALID_FLAG("$2That is not a valid flag", "Flag"), + NOT_VALID_FLAG_SUGGESTED("$2That is not a valid flag. Did you mean: $1%s", "Flag"), + NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"), + FLAG_NOT_IN_PLOT("$2The plot does not have that flag", "Flag"), + FLAG_NOT_REMOVED("$2The flag could not be removed", "Flag"), + FLAG_NOT_ADDED("$2The flag could not be added", "Flag"), + FLAG_REMOVED("$4Successfully removed flag", "Flag"), + FLAG_ADDED("$4Successfully added flag", "Flag"), + FLAG_TUTORIAL_USAGE("$1Have an admin set the flag: $2%s", "CommandConfig"), + // + // + TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), + TRUSTED_REMOVED("$4You successfully removed a trusted user from the plot", "Trusted"), + WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), + PLOT_REMOVED_USER("$1Plot %s of which you were added to has been deleted due to owner inactivity", "Trusted"), + // + // + REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"), + ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"), - NEED_ON_OFF("$2You need to specify a value. Possible values: $1on$2, $1off", - "Rain"), SETTING_UPDATED("$4You successfully updated the setting", "Rain"), - /* - * Flag - */ - - FLAG_KEY("$2Key: %s", "Flag"), FLAG_TYPE("$2Type: %s", "Flag"), - - FLAG_DESC("$2Desc: %s", "Flag"), NOT_VALID_FLAG("$2That is not a valid flag", "Flag"), - - NOT_VALID_FLAG_SUGGESTED("$2That is not a valid flag. Did you mean: $1%s", - "Flag"), NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"), - - FLAG_NOT_IN_PLOT("$2The plot does not have that flag", "Flag"), FLAG_NOT_REMOVED( - "$2The flag could not be removed", "Flag"), - - FLAG_NOT_ADDED("$2The flag could not be added", "Flag"), FLAG_REMOVED( - "$4Successfully removed flag", "Flag"), - - FLAG_ADDED("$4Successfully added flag", "Flag"), FLAG_TUTORIAL_USAGE( - "$1Have an admin set the flag: $2%s", "CommandConfig"), - /* - * Trusted - */ - - TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), TRUSTED_REMOVED( - "$4You successfully removed a trusted user from the plot", "Trusted"), - - WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), PLOT_REMOVED_USER( - "$1Plot %s of which you were added to has been deleted due to owner inactivity", - "Trusted"), - /* - * Member - */ - - REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"), ALREADY_OWNER( - "$2That user is already the plot owner: %s0", "Member"), - - ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), MEMBER_ADDED( - "$4That user can now build while the plot owner is online", "Member"), - - MEMBER_REMOVED("$1You successfully removed a user from the plot", - "Member"), MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", - "Member"), + ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"), + MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"), + MEMBER_REMOVED("$1You successfully removed a user from the plot", "Member"), + MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"), PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"), - /* - * Set Owner - */ - - SET_OWNER("$4You successfully set the plot owner", "Owner"), SET_OWNER_CANCELLED( - "$2The setowner action was cancelled", "Owner"), - + // + // + SET_OWNER("$4You successfully set the plot owner", "Owner"), + SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"), NOW_OWNER("$4You are now owner of plot %s", "Owner"), - /* - * Signs - */ - - OWNER_SIGN_LINE_1("$1ID: $1%id%", "Signs"), OWNER_SIGN_LINE_2("$1Owner:", "Signs"), - - OWNER_SIGN_LINE_3("$2%plr%", "Signs"), OWNER_SIGN_LINE_4("$3Claimed", "Signs"), - /* - * Help - */ - - HELP_HEADER("$3&m---------&r $1Plot\u00B2 Help $3&m---------", "Help"), HELP_PAGE_HEADER( - "$1Category: $2%category%$2,$1 Page: $2%current%$3/$2%max%$2", "Help"), - - HELP_FOOTER("$3&m---------&r $1Plot\u00B2 Help $3&m---------", "Help"), - - HELP_INFO_ITEM("$1/plot help %category% $3- $2%category_desc%", "Help"), HELP_ITEM( - "$1%usage% [%alias%]&- $3- $2%desc%&-", "Help"), - + // + // + OWNER_SIGN_LINE_1("$1ID: $1%id%", "Signs"), + OWNER_SIGN_LINE_2("$1Owner:", "Signs"), + OWNER_SIGN_LINE_3("$2%plr%", "Signs"), + OWNER_SIGN_LINE_4("$3Claimed", "Signs"), + // + // + HELP_HEADER("$3&m---------&r $1Plot² Help $3&m---------", "Help"), + HELP_PAGE_HEADER("$1Category: $2%category%$2,$1 Page: $2%current%$3/$2%max%$2", "Help"), + HELP_FOOTER("$3&m---------&r $1Plot² Help $3&m---------", "Help"), + HELP_INFO_ITEM("$1/plot help %category% $3- $2%category_desc%", "Help"), + HELP_ITEM("$1%usage% [%alias%]&- $3- $2%desc%&-", "Help"), HELP_DISPLAY_ALL_COMMANDS("Display all commands", "Help"), + DIRECTION("$1Current direction: %dir%", "Help"), + // BUCKET_ENTRIES_IGNORED( "$2Total bucket values add up to 1 or more. Blocks without a spcified chance will be ignored", "Generator_Bucket"), - /** * Command Categories */ - COMMAND_CATEGORY_CLAIMING("Claiming", "Category"), COMMAND_CATEGORY_TELEPPORT("Teleport", - "Category"), COMMAND_CATEGORY_SETTINGS("Protection", "Category"), COMMAND_CATEGORY_CHAT( - "Chat", "Category"), COMMAND_CATEGORY_SCHEMATIC("Web", - "Category"), COMMAND_CATEGORY_APPEARANCE("Cosmetic", "Category"), COMMAND_CATEGORY_INFO( - "Info", "Category"), COMMAND_CATEGORY_DEBUG("Debug", - "Category"), COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), + COMMAND_CATEGORY_CLAIMING("Claiming", "Category"), + COMMAND_CATEGORY_TELEPORT("Teleport", "Category"), + COMMAND_CATEGORY_SETTINGS("Protection", "Category"), + COMMAND_CATEGORY_CHAT("Chat", "Category"), + COMMAND_CATEGORY_SCHEMATIC("Web", "Category"), + COMMAND_CATEGORY_APPEARANCE("Cosmetic", "Category"), + COMMAND_CATEGORY_INFO("Info", "Category"), + COMMAND_CATEGORY_DEBUG("Debug", "Category"), + COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), - /* - * Direction - */ - - DIRECTION("$1Current direction: %dir%", "Help"), - /* - * Grant - */ - - GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), GRANTED_PLOT( - "$1You granted %s0 plot to $2%s1", "Grants"), + // + GRANTED_PLOTS("$1Result: $2%s $1grants left", "Grants"), + GRANTED_PLOT("$1You granted %s0 plot to $2%s1", "Grants"), GRANTED_PLOT_FAILED("$1Grant failed: $2%s", "Grants"), - /* - * Custom - */ + // /** * Legacy Configuration Conversion @@ -915,48 +746,25 @@ public enum Captions { public static final HashMap replacements = new HashMap<>(); - /** - * Default. - */ - private final String def; - /** - * What locale category should this translation fall under. - */ + private final String defaultString; private final String category; - /** - * Should the string be prefixed. - */ private final boolean prefix; - /** - * Translated. - */ - private String s; + private String translatedString; - /** - * Constructor. - * - * @param def default - * @param prefix use prefix - */ - Captions(String def, boolean prefix, String category) { - this.def = def; - this.s = def; + Captions(String defaultString, boolean prefix, String category) { + this.defaultString = defaultString; + this.translatedString = defaultString; this.prefix = prefix; this.category = category.toLowerCase(); } - /** - * Constructor. - * - * @param def default - */ - Captions(String def, String category) { - this(def, true, category.toLowerCase()); + Captions(String defaultString, String category) { + this(defaultString, true, category.toLowerCase()); } - public static String format(String m, Object... args) { + public static String format(String message, Object... args) { if (args.length == 0) { - return m; + return message; } Map map = new LinkedHashMap<>(); for (int i = args.length - 1; i >= 0; i--) { @@ -971,15 +779,15 @@ public enum Captions { map.put("%s", arg); } } - m = StringMan.replaceFromMap(m, map); - return m; + message = StringMan.replaceFromMap(message, map); + return message; } public static String format(Captions caption, Object... args) { - if (caption.usePrefix() && caption.s.length() > 0) { - return Captions.PREFIX.s() + format(caption.s, args); + if (caption.usePrefix() && caption.translatedString.length() > 0) { + return Captions.PREFIX.getTranslated() + format(caption.translatedString, args); } else { - return format(caption.s, args); + return format(caption.translatedString, args); } } @@ -1031,7 +839,7 @@ public enum Captions { yml.set(caption.category + '.' + caption.name().toLowerCase(), value); } captions.add(caption); - caption.s = value; + caption.translatedString = value; } else { toRemove.add(key); } @@ -1059,9 +867,11 @@ public enum Captions { continue; } changed = true; - yml.set(caption.category + '.' + caption.name().toLowerCase(), caption.def); + yml.set(caption.category + '.' + caption.name().toLowerCase(), + caption.defaultString); } - caption.s = StringMan.replaceFromMap(caption.s, replacements); + caption.translatedString = + StringMan.replaceFromMap(caption.translatedString, replacements); } if (changed) { yml.save(file); @@ -1072,15 +882,15 @@ public enum Captions { } public String f(final Object... args) { - return format(s(), args); + return format(getTranslated(), args); } @Override public String toString() { - return this.s; + return this.translatedString; } - public String s() { - return this.s; + public String getTranslated() { + return this.translatedString; } public boolean usePrefix() { @@ -1088,7 +898,7 @@ public enum Captions { } public String formatted() { - return StringMan.replaceFromMap(s(), replacements); + return StringMan.replaceFromMap(getTranslated(), replacements); } public String getCategory() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java index a0b12d511..135149279 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridUtils.java @@ -7,7 +7,11 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.WEExtent; import com.github.intellectualsites.plotsquared.plot.object.*; -import com.github.intellectualsites.plotsquared.plot.util.*; +import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; +import com.github.intellectualsites.plotsquared.plot.util.MathMan; +import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; +import com.github.intellectualsites.plotsquared.plot.util.TaskManager; +import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis; @@ -167,7 +171,7 @@ public abstract class HybridUtils { regeneratePlotWalls(area); HybridUtils.UPDATE = false; - PlotSquared.debug(Captions.PREFIX.s() + "Finished road conversion"); + PlotSquared.debug(Captions.PREFIX.getTranslated() + "Finished road conversion"); // CANCEL TASK } else { final Runnable task = this; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java index 5f2260922..50b2f5398 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/PlotListener.java @@ -57,7 +57,9 @@ public class PlotListener { Optional greetingFlag = plot.getFlag(Flags.GREETING); if (greetingFlag.isPresent()) { greeting = greetingFlag.get(); - MainUtil.format(Captions.PREFIX_GREETING.s() + greeting, plot, player, false, + MainUtil + .format(Captions.PREFIX_GREETING.getTranslated() + greeting, plot, player, + false, new RunnableVal() { @Override public void run(String value) { MainUtil.sendMessage(player, value); @@ -72,8 +74,8 @@ public class PlotListener { for (UUID uuid : plot.getOwners()) { PlotPlayer owner = UUIDHandler.getPlayer(uuid); if (owner != null && !owner.getUUID().equals(player.getUUID())) { - MainUtil.sendMessage(owner, - Captions.NOTIFY_ENTER.s().replace("%player", player.getName()) + MainUtil.sendMessage(owner, Captions.NOTIFY_ENTER.getTranslated() + .replace("%player", player.getName()) .replace("%plot", plot.getId().toString())); } } @@ -99,7 +101,8 @@ public class PlotListener { player.setGameMode(gamemodeFlag.get()); } else { MainUtil.sendMessage(player, StringMan - .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", + .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), + "{plot}", plot.getId(), "{gamemode}", gamemodeFlag.get())); } } @@ -112,7 +115,8 @@ public class PlotListener { player.setGameMode(guestGamemodeFlag.get()); } else { MainUtil.sendMessage(player, StringMan - .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", + .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), + "{plot}", plot.getId(), "{gamemode}", guestGamemodeFlag.get())); } } @@ -160,8 +164,8 @@ public class PlotListener { CommentManager.sendTitle(player, plot); } if (titles) { - if (!Captions.TITLE_ENTERED_PLOT.s().isEmpty() || !Captions.TITLE_ENTERED_PLOT_SUB - .s().isEmpty()) { + if (!Captions.TITLE_ENTERED_PLOT.getTranslated().isEmpty() + || !Captions.TITLE_ENTERED_PLOT_SUB.getTranslated().isEmpty()) { TaskManager.runTaskLaterAsync(() -> { Plot lastPlot = player.getMeta(PlotPlayer.META_LAST_PLOT); if ((lastPlot != null) && plot.getId().equals(lastPlot.getId())) { @@ -173,9 +177,11 @@ public class PlotListener { replacements.put("%alias", plot.toString()); replacements.put("%s", MainUtil.getName(plot.getOwner())); String main = StringMan - .replaceFromMap(Captions.TITLE_ENTERED_PLOT.s(), replacements); + .replaceFromMap(Captions.TITLE_ENTERED_PLOT.getTranslated(), + replacements); String sub = StringMan - .replaceFromMap(Captions.TITLE_ENTERED_PLOT_SUB.s(), replacements); + .replaceFromMap(Captions.TITLE_ENTERED_PLOT_SUB.getTranslated(), + replacements); player.sendTitle(main, sub); } }, 20); @@ -207,14 +213,14 @@ public class PlotListener { player.setGameMode(pw.GAMEMODE); } else { MainUtil.sendMessage(player, StringMan - .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.s(), "{plot}", + .replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}", plot.toString(), "{gamemode}", pw.GAMEMODE.name().toLowerCase())); } } } Optional farewell = plot.getFlag(Flags.FAREWELL); farewell.ifPresent(s -> MainUtil - .format(Captions.PREFIX_FAREWELL.s() + s, plot, player, false, + .format(Captions.PREFIX_FAREWELL.getTranslated() + s, plot, player, false, new RunnableVal() { @Override public void run(String value) { MainUtil.sendMessage(player, value); @@ -226,8 +232,8 @@ public class PlotListener { for (UUID uuid : plot.getOwners()) { PlotPlayer owner = UUIDHandler.getPlayer(uuid); if ((owner != null) && !owner.getUUID().equals(player.getUUID())) { - MainUtil.sendMessage(owner, - Captions.NOTIFY_LEAVE.s().replace("%player", player.getName()) + MainUtil.sendMessage(owner, Captions.NOTIFY_LEAVE.getTranslated() + .replace("%player", player.getName()) .replace("%plot", plot.getId().toString())); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index 4c0d35cba..b1098e6f3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -2136,7 +2136,7 @@ public class Plot { } loop: for (int i = 4; i > 0; i--) { - String caption = Captions.valueOf("OWNER_SIGN_LINE_" + i).s(); + String caption = Captions.valueOf("OWNER_SIGN_LINE_" + i).getTranslated(); int index = caption.indexOf("%plr%"); if (index < 0) { continue; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java index 19441a2d1..09bc364f1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java @@ -171,15 +171,15 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { } public int hasPermissionRange(String stub, int range) { - if (hasPermission(Captions.PERMISSION_ADMIN.s())) { + if (hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { return Integer.MAX_VALUE; } String[] nodes = stub.split("\\."); StringBuilder builder = new StringBuilder(); for (int i = 0; i < (nodes.length - 1); i++) { builder.append(nodes[i]).append("."); - if (!stub.equals(builder + Captions.PERMISSION_STAR.s())) { - if (hasPermission(builder + Captions.PERMISSION_STAR.s())) { + if (!stub.equals(builder + Captions.PERMISSION_STAR.getTranslated())) { + if (hasPermission(builder + Captions.PERMISSION_STAR.getTranslated())) { return Integer.MAX_VALUE; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java index bd5356be1..4eff629d6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java @@ -44,8 +44,8 @@ public class CommentManager { total = count.get(); } if ((size.decrementAndGet() == 0) && (total > 0)) { - player.sendTitle("", - Captions.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total)); + player.sendTitle("", Captions.INBOX_NOTIFICATION.getTranslated() + .replaceAll("%s", "" + total)); } } }); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java index 6229e9332..0a5b77515 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java @@ -111,13 +111,13 @@ public abstract class EventUtil { return true; case BREAK_BLOCK: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } Optional> use = plot.getFlag(Flags.USE); @@ -137,126 +137,128 @@ public abstract class EventUtil { } } if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { + .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), + false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s() + '/' + Captions.FLAG_BREAK.s())); + Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_BREAK.getTranslated())); case BREAK_HANGING: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.HANGING_BREAK).orElse(false)) { return true; } if (plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_HANGING_BREAK.s())); + Captions.FLAG_HANGING_BREAK.getTranslated())); } - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); case BREAK_MISC: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.MISC_BREAK).orElse(false)) { return true; } if (plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_MISC_BREAK.s())); + Captions.FLAG_MISC_BREAK.getTranslated())); } - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); case BREAK_VEHICLE: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.VEHICLE_BREAK).orElse(false)) { return true; } if (plot.hasOwner()) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_VEHICLE_BREAK.s())); + Captions.FLAG_VEHICLE_BREAK.getTranslated())); } - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); case INTERACT_BLOCK: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } Optional> flagValue = plot.getFlag(Flags.USE); HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false) || !(!notifyPerms || MainUtil - .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, Captions.FLAG_USE.s())); + .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, + Captions.FLAG_USE.getTranslated())); } return true; } case PLACE_BLOCK: { if (plot == null) { return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_ROAD.s(), + .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_BUILD_UNOWNED.getTranslated(), notifyPerms); } Optional> flagValue = plot.getFlag(Flags.PLACE); HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_OTHER.s(), false)) { + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_BUILD_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_PLACE.s())); + Captions.FLAG_PLACE.getTranslated())); } return true; } case TRIGGER_PHYSICAL: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), false); + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), false); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), false); } if (plot.getFlag(Flags.DEVICE_INTERACT).orElse(false)) { @@ -266,8 +268,8 @@ public abstract class EventUtil { HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } @@ -277,13 +279,13 @@ public abstract class EventUtil { } case INTERACT_HANGING: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) { @@ -293,26 +295,27 @@ public abstract class EventUtil { HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s() + '/' + Captions.FLAG_HANGING_INTERACT.s())); + Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_HANGING_INTERACT + .getTranslated())); } return true; } case INTERACT_MISC: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) { @@ -322,26 +325,27 @@ public abstract class EventUtil { HashSet value = flag.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s() + '/' + Captions.FLAG_MISC_INTERACT.s())); + Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_MISC_INTERACT + .getTranslated())); } return true; } case INTERACT_VEHICLE: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) { @@ -351,26 +355,27 @@ public abstract class EventUtil { HashSet value = flag.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_USE.s() + '/' + Captions.FLAG_VEHICLE_USE.s())); + Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_VEHICLE_USE + .getTranslated())); } return true; } case SPAWN_MOB: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.MOB_PLACE).orElse(false)) { @@ -380,26 +385,27 @@ public abstract class EventUtil { HashSet value = flagValue.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_MOB_PLACE.s() + '/' + Captions.FLAG_PLACE.s())); + Captions.FLAG_MOB_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE + .getTranslated())); } return true; } case PLACE_MISC: { if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.MISC_PLACE).orElse(false)) { @@ -409,27 +415,28 @@ public abstract class EventUtil { HashSet value = flag.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_MISC_PLACE.s() + '/' + Captions.FLAG_PLACE.s())); + Captions.FLAG_MISC_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE + .getTranslated())); } return true; } case PLACE_VEHICLE: if (plot == null) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_ROAD.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); } if (!plot.hasOwner()) { - return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), + return Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); } if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) { @@ -439,14 +446,15 @@ public abstract class EventUtil { HashSet value = flag.orElse(null); if (value == null || !PlotBlock.containsEverything(value) && !value .contains(block.getPlotBlock())) { - if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.s(), + if (Permissions.hasPermission(player, + Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)) { return true; } return !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, - Captions.FLAG_VEHICLE_PLACE.s() + '/' + Captions.FLAG_PLACE.s())); + Captions.FLAG_VEHICLE_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE + .getTranslated())); } return true; default: diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java index b94006533..e45d70caf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java @@ -88,7 +88,7 @@ public class MainUtil { public static void sendAdmin(final String s) { for (final PlotPlayer player : UUIDHandler.getPlayers().values()) { - if (player.hasPermission(Captions.PERMISSION_ADMIN.s())) { + if (player.hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { player.sendMessage(Captions.color(s)); } } @@ -331,17 +331,17 @@ public class MainUtil { */ @Nonnull public static String getName(UUID owner) { if (owner == null) { - return Captions.NONE.s(); + return Captions.NONE.getTranslated(); } if (owner.equals(DBFunc.EVERYONE)) { - return Captions.EVERYONE.s(); + return Captions.EVERYONE.getTranslated(); } if (owner.equals(DBFunc.SERVER)) { - return Captions.SERVER.s(); + return Captions.SERVER.getTranslated(); } String name = UUIDHandler.getName(owner); if (name == null) { - return Captions.UNKNOWN.s(); + return Captions.UNKNOWN.getTranslated(); } return name; } @@ -588,10 +588,11 @@ public class MainUtil { public static boolean sendMessage(CommandCaller player, String msg, boolean prefix) { if (!msg.isEmpty()) { if (player == null) { - String message = (prefix ? Captions.PREFIX.s() : "") + msg; + String message = (prefix ? Captions.PREFIX.getTranslated() : "") + msg; PlotSquared.log(message); } else { - player.sendMessage((prefix ? Captions.PREFIX.s() : "") + Captions.color(msg)); + player.sendMessage( + (prefix ? Captions.PREFIX.getTranslated() : "") + Captions.color(msg)); } } return true; @@ -617,7 +618,7 @@ public class MainUtil { */ public static boolean sendMessage(final CommandCaller player, final Captions caption, final Object... args) { - if (caption.s().isEmpty()) { + if (caption.getTranslated().isEmpty()) { return true; } TaskManager.runTaskAsync(() -> { @@ -713,7 +714,7 @@ public class MainUtil { public static void format(String info, final Plot plot, PlotPlayer player, final boolean full, final RunnableVal whenDone) { int num = plot.getConnectedPlots().size(); - String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : Captions.NONE.s(); + String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : Captions.NONE.getTranslated(); Location bot = plot.getCorners()[0]; String biome = WorldUtil.IMP.getBiome(plot.getWorldName(), bot.getX(), bot.getZ()); String trusted = getPlayerList(plot.getTrusted()); @@ -722,28 +723,27 @@ public class MainUtil { String seen; if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) { if (plot.isOnline()) { - seen = Captions.NOW.s(); + seen = Captions.NOW.getTranslated(); } else { int time = (int) (ExpireManager.IMP.getAge(plot) / 1000); if (time != 0) { seen = MainUtil.secToTime(time); } else { - seen = Captions.UNKNOWN.s(); + seen = Captions.UNKNOWN.getTranslated(); } } } else { - seen = Captions.NEVER.s(); + seen = Captions.NEVER.getTranslated(); } Optional descriptionFlag = plot.getFlag(Flags.DESCRIPTION); - String description = !descriptionFlag.isPresent() ? - Captions.NONE.s() : + String description = !descriptionFlag.isPresent() ? Captions.NONE.getTranslated() : Flags.DESCRIPTION.valueToString(descriptionFlag.get()); StringBuilder flags = new StringBuilder(); HashMap, Object> flagMap = FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true); if (flagMap.isEmpty()) { - flags.append(Captions.NONE.s()); + flags.append(Captions.NONE.getTranslated()); } else { String prefix = ""; for (Entry, Object> entry : flagMap.entrySet()) { @@ -837,11 +837,11 @@ public class MainUtil { public static String getPlayerList(Collection uuids) { ArrayList l = new ArrayList<>(uuids); if (l.size() < 1) { - return Captions.NONE.s(); + return Captions.NONE.getTranslated(); } List users = l.stream().map(MainUtil::getName).sorted().collect(Collectors.toList()); - String c = Captions.PLOT_USER_LIST.s(); + String c = Captions.PLOT_USER_LIST.getTranslated(); StringBuilder list = new StringBuilder(); for (int x = 0; x < users.size(); x++) { if (x + 1 == l.size()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java index 82f3eb879..c9a332bb9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/Permissions.java @@ -15,7 +15,7 @@ import java.util.HashMap; public class Permissions { public static boolean hasPermission(PlotPlayer player, Captions caption, boolean notify) { - return hasPermission(player, caption.s(), notify); + return hasPermission(player, caption.getTranslated(), notify); } /** @@ -26,7 +26,7 @@ public class Permissions { * @return */ public static boolean hasPermission(PlotPlayer player, Captions caption) { - return hasPermission(player, caption.s()); + return hasPermission(player, caption.getTranslated()); } /** @@ -68,7 +68,7 @@ public class Permissions { } else if (caller.isPermissionSet(permission)) { return false; } - if (caller.hasPermission(Captions.PERMISSION_ADMIN.s())) { + if (caller.hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { return true; } permission = permission.toLowerCase().replaceAll("^[^a-z|0-9|\\.|_|-]", ""); @@ -76,7 +76,7 @@ public class Permissions { StringBuilder n = new StringBuilder(); for (int i = 0; i <= (nodes.length - 1); i++) { n.append(nodes[i] + "."); - String combined = n + Captions.PERMISSION_STAR.s(); + String combined = n + Captions.PERMISSION_STAR.getTranslated(); if (!permission.equals(combined)) { if (caller.hasPermission(combined)) { return true; @@ -107,7 +107,7 @@ public class Permissions { } public static int hasPermissionRange(PlotPlayer player, Captions perm, int range) { - return hasPermissionRange(player, perm.s(), range); + return hasPermissionRange(player, perm.getTranslated(), range); } /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java index feb58f51f..315687463 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java @@ -102,7 +102,7 @@ public class UUIDHandler { return null; } if (uuid != null && uuid.equals(DBFunc.SERVER)) { - return Captions.SERVER.s(); + return Captions.SERVER.getTranslated(); } return implementation.getName(uuid); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java index f753b21e9..9981dd0f1 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpObject.java @@ -10,7 +10,7 @@ public class HelpObject { private final String _rendered; public HelpObject(final Command command, final String label) { - _rendered = StringMan.replaceAll(Captions.HELP_ITEM.s(), "%usage%", + _rendered = StringMan.replaceAll(Captions.HELP_ITEM.getTranslated(), "%usage%", command.getUsage().replaceAll("\\{label\\}", label), "[%alias%]", !command.getAliases().isEmpty() ? "(" + StringMan.join(command.getAliases(), "|") + ")" : diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java index 3f29aefb1..5b165d32a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/helpmenu/HelpPage.java @@ -16,7 +16,7 @@ public class HelpPage { public HelpPage(CommandCategory category, int currentPage, int maxPages) { this.helpObjects = new ArrayList<>(); - this.header = Captions.HELP_PAGE_HEADER.s() + this.header = Captions.HELP_PAGE_HEADER.getTranslated() .replace("%category%", category == null ? "ALL" : category.toString()) .replace("%current%", (currentPage + 1) + "").replace("%max%", (maxPages + 1) + ""); } @@ -25,8 +25,9 @@ public class HelpPage { if (this.helpObjects.size() < 1) { MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0)"); } else { - String message = Captions.HELP_HEADER.s() + "\n" + this.header + "\n" + StringMan - .join(this.helpObjects, "\n") + "\n" + Captions.HELP_FOOTER.s(); + String message = + Captions.HELP_HEADER.getTranslated() + "\n" + this.header + "\n" + StringMan + .join(this.helpObjects, "\n") + "\n" + Captions.HELP_FOOTER.getTranslated(); MainUtil.sendMessage(player, message, false); } }