From 41a623a643ccbeb897208622db684253db335f4c Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Tue, 4 Aug 2020 19:01:25 +0200 Subject: [PATCH] More work towards json --- .../com/plotsquared/core/PlotSquared.java | 12 +++----- .../com/plotsquared/core/command/Add.java | 8 +++--- .../com/plotsquared/core/command/Biome.java | 2 +- .../com/plotsquared/core/command/Buy.java | 14 +++++----- .../com/plotsquared/core/command/Claim.java | 7 +++-- .../com/plotsquared/core/command/Clear.java | 8 +++--- .../com/plotsquared/core/command/Cluster.java | 20 ++++++------- .../plotsquared/core/command/Continue.java | 4 +-- .../com/plotsquared/core/command/Copy.java | 2 +- .../com/plotsquared/core/command/Delete.java | 3 +- .../plotsquared/core/command/Download.java | 7 +++-- .../com/plotsquared/core/command/Grant.java | 7 +++-- .../plotsquared/core/command/HomeCommand.java | 2 +- .../com/plotsquared/core/command/Kick.java | 2 +- .../components/ComponentPresetManager.java | 16 ++++++----- .../core/listener/PlotListener.java | 8 ++---- .../core/permissions/PermissionHolder.java | 6 ++-- .../plotsquared/core/player/PlotPlayer.java | 1 - .../com/plotsquared/core/plot/PlotArea.java | 5 ++-- .../plotsquared/core/plot/PlotAreaType.java | 7 +++-- .../flag/implementations/AnalysisFlag.java | 4 +-- .../implementations/AnimalAttackFlag.java | 3 +- .../flag/implementations/AnimalCapFlag.java | 3 +- .../implementations/AnimalInteractFlag.java | 3 +- .../flag/implementations/BlockBurnFlag.java | 3 +- .../implementations/BlockIgnitionFlag.java | 3 +- .../flag/implementations/BlockedCmdsFlag.java | 6 ++-- .../plot/flag/implementations/BreakFlag.java | 4 +-- .../plot/flag/implementations/ChatFlag.java | 4 +-- .../flag/implementations/CoralDryFlag.java | 4 +-- .../flag/implementations/DenyExitFlag.java | 4 +-- .../implementations/DenyTeleportFlag.java | 9 +++--- .../flag/implementations/DescriptionFlag.java | 4 +-- .../implementations/DeviceInteractFlag.java | 4 +-- .../implementations/DisablePhysicsFlag.java | 4 +-- .../plot/flag/implementations/DoneFlag.java | 3 +- .../implementations/DropProtectionFlag.java | 4 +-- .../flag/implementations/EntityCapFlag.java | 4 +-- .../flag/implementations/ExplosionFlag.java | 4 +-- .../flag/implementations/FarewellFlag.java | 4 +-- .../plot/flag/implementations/FeedFlag.java | 9 +++--- .../plot/flag/implementations/FlyFlag.java | 4 +-- .../flag/implementations/ForcefieldFlag.java | 4 +-- .../flag/implementations/GamemodeFlag.java | 4 +-- .../flag/implementations/GrassGrowFlag.java | 4 +-- .../flag/implementations/GreetingFlag.java | 4 +-- .../implementations/GuestGamemodeFlag.java | 4 +-- .../implementations/HangingBreakFlag.java | 3 +- .../implementations/HangingPlaceFlag.java | 4 +-- .../plot/flag/implementations/HealFlag.java | 8 ++++-- .../flag/implementations/HideInfoFlag.java | 4 +-- .../implementations/HostileAttackFlag.java | 4 +-- .../flag/implementations/HostileCapFlag.java | 4 +-- .../implementations/HostileInteractFlag.java | 4 +-- .../flag/implementations/IceFormFlag.java | 4 +-- .../flag/implementations/IceMeltFlag.java | 4 +-- .../flag/implementations/InstabreakFlag.java | 4 +-- .../flag/implementations/InvincibleFlag.java | 4 +-- .../flag/implementations/ItemDropFlag.java | 4 +-- .../plot/flag/implementations/KeepFlag.java | 6 ++-- .../implementations/KeepInventoryFlag.java | 4 +-- .../flag/implementations/KelpGrowFlag.java | 4 +-- .../flag/implementations/LiquidFlowFlag.java | 4 +-- .../flag/implementations/MiscBreakFlag.java | 4 +-- .../flag/implementations/MiscCapFlag.java | 4 +-- .../implementations/MiscInteractFlag.java | 4 +-- .../flag/implementations/MiscPlaceFlag.java | 4 +-- .../flag/implementations/MobBreakFlag.java | 4 +-- .../plot/flag/implementations/MobCapFlag.java | 4 +-- .../flag/implementations/MobPlaceFlag.java | 4 +-- .../plot/flag/implementations/MusicFlag.java | 6 ++-- .../flag/implementations/MycelGrowFlag.java | 4 +-- .../flag/implementations/NoWorldeditFlag.java | 4 +-- .../flag/implementations/NotifyEnterFlag.java | 4 +-- .../flag/implementations/NotifyLeaveFlag.java | 4 +-- .../plot/flag/implementations/PlaceFlag.java | 4 +-- .../implementations/PlayerInteractFlag.java | 4 +-- .../PreventCreativeCopyFlag.java | 4 +-- .../plot/flag/implementations/PriceFlag.java | 4 +-- .../plot/flag/implementations/PveFlag.java | 4 +-- .../plot/flag/implementations/PvpFlag.java | 4 +-- .../flag/implementations/RedstoneFlag.java | 4 +-- .../flag/implementations/ServerPlotFlag.java | 4 +-- .../flag/implementations/SnowFormFlag.java | 4 +-- .../flag/implementations/SnowMeltFlag.java | 4 +-- .../flag/implementations/SoilDryFlag.java | 4 +-- .../flag/implementations/TamedAttackFlag.java | 4 +-- .../implementations/TamedInteractFlag.java | 4 +-- .../plot/flag/implementations/TimeFlag.java | 4 +-- .../plot/flag/implementations/TitlesFlag.java | 8 +++--- .../implementations/UntrustedVisitFlag.java | 4 +-- .../plot/flag/implementations/UseFlag.java | 4 +-- .../implementations/VehicleBreakFlag.java | 4 +-- .../flag/implementations/VehicleCapFlag.java | 4 +-- .../implementations/VehiclePlaceFlag.java | 4 +-- .../flag/implementations/VehicleUseFlag.java | 4 +-- .../implementations/VillagerInteractFlag.java | 4 +-- .../flag/implementations/VineGrowFlag.java | 4 +-- .../flag/implementations/WeatherFlag.java | 3 +- .../plot/flag/types/BlockTypeListFlag.java | 5 ++-- .../core/plot/flag/types/BooleanFlag.java | 5 ++-- .../core/plot/flag/types/DoubleFlag.java | 6 ++-- .../core/plot/flag/types/IntegerFlag.java | 5 ++-- .../core/plot/flag/types/LongFlag.java | 7 +++-- .../core/plot/flag/types/NumberFlag.java | 4 +-- .../core/plot/flag/types/TimedFlag.java | 9 +++--- .../core/util/EventDispatcher.java | 28 +++++++++---------- .../plotsquared/core/util/PatternUtil.java | 5 ++-- .../plotsquared/core/util/PlayerManager.java | 11 ++++---- .../plotsquared/core/uuid/UUIDPipeline.java | 3 +- Core/src/main/resources/lang/messages_en.json | 6 ++-- 111 files changed, 293 insertions(+), 274 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index d09477b36..146cdeeab 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -25,7 +25,6 @@ */ package com.plotsquared.core; -import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.MemorySection; @@ -34,7 +33,6 @@ import com.plotsquared.core.configuration.Storage; import com.plotsquared.core.configuration.caption.CaptionLoader; import com.plotsquared.core.configuration.caption.CaptionMap; import com.plotsquared.core.configuration.caption.DummyCaptionMap; -import com.plotsquared.core.configuration.caption.LocalizedCaptionMap; import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.configuration.serialization.ConfigurationSerialization; @@ -67,10 +65,8 @@ import com.plotsquared.core.plot.world.SinglePlotAreaManager; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.FileUtils; import com.plotsquared.core.util.LegacyConverter; -import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.ReflectionUtils; -import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.uuid.UUIDPipeline; import com.sk89q.worldedit.WorldEdit; @@ -1330,20 +1326,20 @@ public class PlotSquared { .equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worldConfiguration .getString("configuration_version").equalsIgnoreCase("v5"))) { // Conversion needed - logger.info(Captions.LEGACY_CONFIG_FOUND.getTranslated()); + logger.info("[P2] &aA legacy configuration file was detected. Conversion will be attempted."); try { com.google.common.io.Files .copy(this.worldsFile, new File(folder, "worlds.yml.old")); - logger.info(Captions.LEGACY_CONFIG_BACKUP.getTranslated()); + logger.info("[P2] &6A copy of worlds.yml has been saved in the file worlds.yml.old"); final ConfigurationSection worlds = this.worldConfiguration.getConfigurationSection("worlds"); final LegacyConverter converter = new LegacyConverter(worlds); converter.convert(); this.worldConfiguration.set("worlds", worlds); this.setConfigurationVersion(LegacyConverter.CONFIGURATION_VERSION); - logger.info(Captions.LEGACY_CONFIG_DONE.getTranslated()); + logger.info("[P2] &aThe conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics."); } catch (final Exception e) { - logger.error(Captions.LEGACY_CONFIG_CONVERSION_FAILED.getTranslated(), e); + logger.error("[P2] &cFailed to convert the legacy configuration file. See stack trace for information.", e); } // Disable plugin this.platform.shutdown(); diff --git a/Core/src/main/java/com/plotsquared/core/command/Add.java b/Core/src/main/java/com/plotsquared/core/command/Add.java index 7c0d204bd..4f46ec66b 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Add.java +++ b/Core/src/main/java/com/plotsquared/core/command/Add.java @@ -66,11 +66,11 @@ public class Add extends Command { public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); - checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED); + final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); + checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned")); checkTrue(plot.isOwner(player.getUUID()) || Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST), - Captions.NO_PLOT_PERMS); + TranslatableCaption.of("permission.no_plot_perms")); checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"), Template.of("value", "/plot add ")); final CompletableFuture future = new CompletableFuture<>(); @@ -116,7 +116,7 @@ public class Add extends Command { } checkTrue(!uuids.isEmpty(), null); checkTrue(size <= plot.getArea().getMaxPlotMembers() || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST), - Captions.PLOT_MAX_MEMBERS); + TranslatableCaption.of("members.plot_max_members")); // Success confirm.run(this, () -> { for (UUID uuid : uuids) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Biome.java b/Core/src/main/java/com/plotsquared/core/command/Biome.java index 6d0f1b055..4fff60db7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Biome.java +++ b/Core/src/main/java/com/plotsquared/core/command/Biome.java @@ -56,7 +56,7 @@ public class Biome extends SetCommand { } if (biome == null) { String biomes = StringMan - .join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated()); + .join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.toString()); player.sendMessage(TranslatableCaption.of("biome.need_biome")); player.sendMessage( TranslatableCaption.of("commandconfig.subcommand_set_options_header"), diff --git a/Core/src/main/java/com/plotsquared/core/command/Buy.java b/Core/src/main/java/com/plotsquared/core/command/Buy.java index c6f753564..e786f03f1 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Buy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Buy.java @@ -69,7 +69,7 @@ public class Buy extends Command { RunnableVal3 confirm, final RunnableVal2 whenDone) { - check(this.econHandler, Captions.ECON_DISABLED); + check(this.econHandler, TranslatableCaption.of("economy.econ_disabled")); final Plot plot; if (args.length != 0) { if (args.length != 1) { @@ -78,18 +78,18 @@ public class Buy extends Command { } plot = check(Plot.getPlotFromString(player, args[0], true), null); } else { - plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); + plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); } - checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED); - checkTrue(!plot.isOwner(player.getUUID()), Captions.CANNOT_BUY_OWN); + checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned")); + checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.of("economy.cannot_buy_own")); Set plots = plot.getConnectedPlots(); checkTrue(player.getPlotCount() + plots.size() <= player.getAllowedPlots(), - Captions.CANT_CLAIM_MORE_PLOTS); + TranslatableCaption.of("permission.cant_claim_more_plots")); double price = plot.getFlag(PriceFlag.class); if (price <= 0) { - throw new CommandException(Captions.NOT_FOR_SALE); + throw new CommandException(TranslatableCaption.of("economy.not_for_sale")); } - checkTrue(player.getMoney() >= price, Captions.CANNOT_AFFORD_PLOT); + checkTrue(player.getMoney() >= price, TranslatableCaption.of("economy.cannot_afford_plot")); player.withdraw(price); // Failure // Success diff --git a/Core/src/main/java/com/plotsquared/core/command/Claim.java b/Core/src/main/java/com/plotsquared/core/command/Claim.java index a4ba9b576..cd78a5c77 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Claim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Claim.java @@ -169,7 +169,8 @@ public class Claim extends SubCommand { } int border = area.getBorder(); if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) { - return !sendMessage(player, Captions.BORDER); + player.sendMessage(TranslatableCaption.of("border.border")); + return false; } plot.setOwnerAbs(player.getUUID()); final String finalSchematic = schematic; @@ -177,7 +178,7 @@ public class Claim extends SubCommand { try { TaskManager.getPlatformImplementation().sync(() -> { if (!plot.claim(player, true, finalSchematic, false)) { - logger.info(Captions.PREFIX.getTranslated() + String + logger.info(TranslatableCaption.of("core.prefix") + String .format("Failed to claim plot %s", plot.getId().toCommaSeparatedString())); player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); plot.setOwnerAbs(null); @@ -199,7 +200,7 @@ public class Claim extends SubCommand { e.printStackTrace(); } }, () -> { - logger.info(Captions.PREFIX.getTranslated() + String + logger.info(TranslatableCaption.of("core.prefix") + String .format("Failed to add plot %s to the database", plot.getId().toCommaSeparatedString())); player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); diff --git a/Core/src/main/java/com/plotsquared/core/command/Clear.java b/Core/src/main/java/com/plotsquared/core/command/Clear.java index 57f03b452..7e225b1fa 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Clear.java +++ b/Core/src/main/java/com/plotsquared/core/command/Clear.java @@ -75,7 +75,7 @@ public class Clear extends Command { sendUsage(player); return CompletableFuture.completedFuture(false); } - final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); + final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); Result eventResult = this.eventDispatcher.callClear(plot).getEventResult(); if (eventResult == Result.DENY) { player.sendMessage( @@ -86,10 +86,10 @@ public class Clear extends Command { boolean force = eventResult == Result.FORCE; checkTrue(force || plot.isOwner(player.getUUID()) || Permissions .hasPermission(player, "plots.admin.command.clear"), - Captions.NO_PLOT_PERMS); - checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER); + TranslatableCaption.of("permission.no_plot_perms")); + checkTrue(plot.getRunning() == 0, TranslatableCaption.of("errors.wait_for_timer")); checkTrue(force || !Settings.Done.RESTRICT_BUILDING || !DoneFlag.isDone(plot) || Permissions - .hasPermission(player, "plots.continue"), Captions.DONE_ALREADY_DONE); + .hasPermission(player, "plots.continue"), TranslatableCaption.of("done.done_already_done")); confirm.run(this, () -> { BackupManager.backup(player, plot, () -> { final long start = System.currentTimeMillis(); diff --git a/Core/src/main/java/com/plotsquared/core/command/Cluster.java b/Core/src/main/java/com/plotsquared/core/command/Cluster.java index 8add7dc08..a99d0072f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Cluster.java +++ b/Core/src/main/java/com/plotsquared/core/command/Cluster.java @@ -426,7 +426,7 @@ public class Cluster extends SubCommand { .hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE_OTHER)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_INVITE_OTHER.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_INVITE_OTHER.toString()) ); return false; } @@ -466,7 +466,7 @@ public class Cluster extends SubCommand { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_KICK.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_KICK.toString()) ); return false; } @@ -491,7 +491,7 @@ public class Cluster extends SubCommand { .hasPermission(player, Captions.PERMISSION_CLUSTER_KICK_OTHER)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_KICK_OTHER.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_KICK_OTHER.toString()) ); return false; } @@ -548,7 +548,7 @@ public class Cluster extends SubCommand { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LEAVE)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_LEAVE.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_LEAVE.toString()) ); return false; } @@ -615,7 +615,7 @@ public class Cluster extends SubCommand { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_HELPERS)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_HELPERS.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_HELPERS.toString()) ); return false; } @@ -670,7 +670,7 @@ public class Cluster extends SubCommand { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_TP.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_TP.toString()) ); return false; } @@ -699,7 +699,7 @@ public class Cluster extends SubCommand { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP_OTHER)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_TP_OTHER.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_TP_OTHER.toString()) ); return false; } @@ -714,7 +714,7 @@ public class Cluster extends SubCommand { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INFO)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_TP.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_TP.toString()) ); return false; } @@ -776,7 +776,7 @@ public class Cluster extends SubCommand { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_SETHOME.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_SETHOME.toString()) ); return false; } @@ -801,7 +801,7 @@ public class Cluster extends SubCommand { .hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME_OTHER)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_CLUSTER_SETHOME_OTHER.getTranslated()) + Template.of("node", Captions.PERMISSION_CLUSTER_SETHOME_OTHER.toString()) ); return false; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Continue.java b/Core/src/main/java/com/plotsquared/core/command/Continue.java index 32b6344a5..d4c44abd0 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Continue.java +++ b/Core/src/main/java/com/plotsquared/core/command/Continue.java @@ -64,7 +64,7 @@ public class Continue extends SubCommand { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CONTINUE)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.NO_PLOT_PERMS.getTranslated()) + Template.of("node", Captions.NO_PLOT_PERMS.toString()) ); return false; } @@ -77,7 +77,7 @@ public class Continue extends SubCommand { < player.getPlotCount() + size)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_ADMIN_COMMAND_CONTINUE.getTranslated()) + Template.of("node", Captions.PERMISSION_ADMIN_COMMAND_CONTINUE.toString()) ); return false; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Copy.java b/Core/src/main/java/com/plotsquared/core/command/Copy.java index eecf4153e..1e17257be 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Copy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Copy.java @@ -50,7 +50,7 @@ public class Copy extends SubCommand { return false; } if (!plot1.isOwner(player.getUUID()) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.toString())) { player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); return false; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Delete.java b/Core/src/main/java/com/plotsquared/core/command/Delete.java index 0655272d6..426e82c97 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Delete.java +++ b/Core/src/main/java/com/plotsquared/core/command/Delete.java @@ -85,7 +85,8 @@ public class Delete extends SubCommand { boolean force = eventResult == Result.FORCE; if (!force && !plot.isOwner(player.getUUID()) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DELETE)) { - return !sendMessage(player, Captions.NO_PLOT_PERMS); + player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); + return false; } final PlotArea plotArea = plot.getArea(); final java.util.Set plots = plot.getConnectedPlots(); diff --git a/Core/src/main/java/com/plotsquared/core/command/Download.java b/Core/src/main/java/com/plotsquared/core/command/Download.java index 423d9ec52..cd2c4c3d2 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Download.java +++ b/Core/src/main/java/com/plotsquared/core/command/Download.java @@ -69,7 +69,8 @@ public class Download extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorldName(); if (!this.plotAreaManager.hasPlotArea(world)) { - return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD); + player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); + return false; } final Plot plot = player.getCurrentPlot(); if (plot == null) { @@ -86,7 +87,7 @@ public class Download extends SubCommand { return false; } if ((!plot.isOwner(player.getUUID())) && !Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { + .hasPermission(player, Captions.PERMISSION_ADMIN.toString())) { player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); return false; } @@ -121,7 +122,7 @@ public class Download extends SubCommand { if (!Permissions.hasPermission(player, Captions.PERMISSION_DOWNLOAD_WORLD)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_DOWNLOAD_WORLD.getTranslated()) + Template.of("node", Captions.PERMISSION_DOWNLOAD_WORLD.toString()) ); return false; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Grant.java b/Core/src/main/java/com/plotsquared/core/command/Grant.java index 413f910ea..9b05045fb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Grant.java +++ b/Core/src/main/java/com/plotsquared/core/command/Grant.java @@ -48,7 +48,7 @@ import java.util.concurrent.TimeoutException; @CommandDeclaration(command = "grant", category = CommandCategory.CLAIMING, - usage = "/plot grant [player]", + usage = "/plot grant [player]", permission = "plots.grant", requiredType = RequiredType.NONE) public class Grant extends Command { @@ -61,7 +61,7 @@ public class Grant extends Command { public CompletableFuture execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - checkTrue(args.length >= 1 && args.length <= 2, Captions.COMMAND_SYNTAX, getUsage()); + checkTrue(args.length >= 1 && args.length <= 2, TranslatableCaption.of("commandconfig.command_syntax"), Template.of("value", "/plot grant [player]")); final String arg0 = args[0].toLowerCase(); switch (arg0) { case "add": @@ -90,7 +90,8 @@ public class Grant extends Command { try (final MetaDataAccess access = pp.accessPersistentMetaData( PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) { if (args[0].equalsIgnoreCase("check")) { - Captions.GRANTED_PLOTS.send(player, access.get().orElse(0)); + player.sendMessage(TranslatableCaption.of("grants.granted_plots"), + Template.of("grants", String.valueOf(access.get().orElse(0)))); } else { access.set(access.get().orElse(0) + 1); } diff --git a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java index 6bff90f9c..c0485d5a3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java @@ -108,7 +108,7 @@ public class HomeCommand extends Command { .hasPermission(player, Captions.PERMISSION_HOME)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - Template.of("node", Captions.PERMISSION_VISIT_OWNED.getTranslated()) + Template.of("node", Captions.PERMISSION_VISIT_OWNED.toString()) ); return CompletableFuture.completedFuture(false); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Kick.java b/Core/src/main/java/com/plotsquared/core/command/Kick.java index 660571202..8554661c5 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Kick.java +++ b/Core/src/main/java/com/plotsquared/core/command/Kick.java @@ -135,7 +135,7 @@ public class Kick extends SubCommand { Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn - player2.kick(Captions.YOU_GOT_KICKED.getTranslated()); + player2.sendMessage(TranslatableCaption.of("kick.you_got_kicked")); } else { player2.plotkick(newSpawn); } diff --git a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java index d7e96b0d8..9aabca729 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java @@ -44,6 +44,7 @@ import com.plotsquared.core.util.PatternUtil; import com.plotsquared.core.util.Permissions; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.item.ItemTypes; +import net.kyori.adventure.text.minimessage.Template; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -134,13 +135,13 @@ public class ComponentPresetManager { final Plot plot = player.getCurrentPlot(); if (plot == null) { - Captions.NOT_IN_PLOT.send(player); + player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); return null; } else if (!plot.hasOwner()) { - Captions.PLOT_UNOWNED.send(player); + player.sendMessage(TranslatableCaption.of("info.plot_unowned")); return null; } else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID())) { - Captions.NO_PLOT_PERMS.send(player); + player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); return null; } @@ -169,23 +170,24 @@ public class ComponentPresetManager { } if (plot.getRunning() > 0) { - Captions.WAIT_FOR_TIMER.send(player); + player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); return false; } final Pattern pattern = PatternUtil.parse(null, componentPreset.getPattern(), false); if (pattern == null) { - Captions.PRESET_INVALID.send(player); + player.sendMessage(TranslatableCaption.of("preset.preset_invalid")); return false; } if (componentPreset.getCost() > 0.0D && econHandler != null && plot.getArea().useEconomy()) { if (econHandler.getMoney(player) < componentPreset.getCost()) { - Captions.PRESET_CANNOT_AFFORD.send(player); + player.sendMessage(TranslatableCaption.of("preset.preset_cannot_afford")); return false; } else { econHandler.withdrawMoney(player, componentPreset.getCost()); - Captions.REMOVED_BALANCE.send(player, componentPreset.getCost() + ""); + player.sendMessage(TranslatableCaption.of("economy.removed_balance"), + Template.of("money", componentPreset.getCost() + "")); } } diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index 2f61759c9..8c2c80965 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -34,7 +34,6 @@ import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.Result; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.MetaDataAccess; -import com.plotsquared.core.player.MetaDataKey; import com.plotsquared.core.player.PlayerMetaDataKeys; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; @@ -61,7 +60,6 @@ import com.plotsquared.core.plot.flag.implementations.WeatherFlag; import com.plotsquared.core.plot.flag.types.TimedFlag; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.Permissions; -import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskTime; import com.sk89q.worldedit.world.gamemode.GameMode; @@ -161,8 +159,7 @@ public class PlotListener { final String greeting = plot.getFlag(GreetingFlag.class); if (!greeting.isEmpty()) { - plot.format(Captions.PREFIX_GREETING.getTranslated() + greeting, player, false) - .thenAcceptAsync(player::sendMessage); + plot.format(greeting, player, false).thenAcceptAsync(player::sendMessage); } if (plot.getFlag(NotifyEnterFlag.class)) { @@ -349,8 +346,7 @@ public class PlotListener { final String farewell = plot.getFlag(FarewellFlag.class); if (!farewell.isEmpty()) { - plot.format(Captions.PREFIX_FAREWELL.getTranslated() + farewell, player, false) - .thenAcceptAsync(player::sendMessage); + plot.format(farewell, player, false).thenAcceptAsync(player::sendMessage); } if (plot.getFlag(NotifyLeaveFlag.class)) { diff --git a/Core/src/main/java/com/plotsquared/core/permissions/PermissionHolder.java b/Core/src/main/java/com/plotsquared/core/permissions/PermissionHolder.java index 7f42c24f0..fc13cc149 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/PermissionHolder.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/PermissionHolder.java @@ -58,15 +58,15 @@ public interface PermissionHolder { */ @Nonnegative default int hasPermissionRange(@Nonnull final String stub, @Nonnegative final int range) { - if (hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { + if (hasPermission(Captions.PERMISSION_ADMIN.toString())) { 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.getTranslated())) { - if (hasPermission(builder + Captions.PERMISSION_STAR.getTranslated())) { + if (!stub.equals(builder + Captions.PERMISSION_STAR.toString())) { + if (hasPermission(builder + Captions.PERMISSION_STAR.toString())) { return Integer.MAX_VALUE; } } diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index 7aa5320bf..3b7c9e7d8 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -33,7 +33,6 @@ import com.plotsquared.core.collection.ByteArrayUtilities; import com.plotsquared.core.command.CommandCaller; import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.configuration.caption.Caption; -import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.caption.CaptionMap; import com.plotsquared.core.configuration.caption.CaptionUtility; diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java index 8b4517bbb..a7e8c72f4 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -35,6 +35,7 @@ import com.plotsquared.core.configuration.ConfigurationNode; import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.generator.GridPlotWorld; import com.plotsquared.core.generator.IndependentPlotGenerator; @@ -371,7 +372,7 @@ public abstract class PlotArea { StringBuilder flagBuilder = new StringBuilder(); Collection> flagCollection = this.getFlagContainer().getFlagMap().values(); if (flagCollection.isEmpty()) { - flagBuilder.append(Captions.NONE.getTranslated()); + flagBuilder.append(TranslatableCaption.of("info.none")); } else { String prefix = " "; for (final PlotFlag flag : flagCollection) { @@ -406,7 +407,7 @@ public abstract class PlotArea { StringBuilder roadFlagBuilder = new StringBuilder(); Collection> roadFlagCollection = this.getFlagContainer().getFlagMap().values(); if (roadFlagCollection.isEmpty()) { - roadFlagBuilder.append(Captions.NONE.getTranslated()); + roadFlagBuilder.append(TranslatableCaption.of("info.none")); } else { roadFlags = true; String prefix = " "; diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotAreaType.java b/Core/src/main/java/com/plotsquared/core/plot/PlotAreaType.java index 7f8325015..84bbeaf8e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotAreaType.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotAreaType.java @@ -27,6 +27,7 @@ package com.plotsquared.core.plot; import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import javax.annotation.Nonnull; import java.util.Map; @@ -36,9 +37,9 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public enum PlotAreaType { - NORMAL(Captions.PLOT_AREA_TYPE_NORMAL), - AUGMENTED(Captions.PLOT_AREA_TYPE_AUGMENTED), - PARTIAL(Captions.PLOT_AREA_TYPE_PARTIAL); + NORMAL(TranslatableCaption.of("plotareatype.plot_area_type_normal")), + AUGMENTED(TranslatableCaption.of("plotareatype.plot_area_type_augmented")), + PARTIAL(TranslatableCaption.of("plotareatype.plot_area_type_partial")); private final Caption description; diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnalysisFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnalysisFlag.java index d0543e6c5..80e312ef5 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnalysisFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnalysisFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.InternalFlag; import com.plotsquared.core.plot.flag.types.ListFlag; @@ -37,7 +37,7 @@ import java.util.List; public class AnalysisFlag extends ListFlag implements InternalFlag { public AnalysisFlag(final List valueList) { - super(valueList, Captions.NONE, Captions.NONE); + super(valueList, TranslatableCaption.of("info.none"), TranslatableCaption.of("info.none")); } @Override public AnalysisFlag parse(@Nonnull String input) throws FlagParseException { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalAttackFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalAttackFlag.java index 2f93b304d..fddd2f54e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalAttackFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalAttackFlag.java @@ -26,6 +26,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +37,7 @@ public class AnimalAttackFlag extends BooleanFlag { public static final AnimalAttackFlag ANIMAL_ATTACK_FALSE = new AnimalAttackFlag(false); private AnimalAttackFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_ANIMAL_ATTACK); + super(value, TranslatableCaption.of("flags.flag_description_animal_attack")); } @Override protected AnimalAttackFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalCapFlag.java index 99285b407..5630f1da5 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalCapFlag.java @@ -26,6 +26,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; import javax.annotation.Nonnull; @@ -34,7 +35,7 @@ public class AnimalCapFlag extends NonNegativeIntegerFlag { public static final AnimalCapFlag ANIMAL_CAP_UNLIMITED = new AnimalCapFlag(Integer.MAX_VALUE); protected AnimalCapFlag(int value) { - super(value, Captions.FLAG_DESCRIPTION_ANIMAL_CAP); + super(value, TranslatableCaption.of("flags.flag_description_animal_cap")); } @Override protected AnimalCapFlag flagOf(@Nonnull Integer value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalInteractFlag.java index 66bcd83e8..b66354b9b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/AnimalInteractFlag.java @@ -26,6 +26,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +37,7 @@ public class AnimalInteractFlag extends BooleanFlag { public static final AnimalInteractFlag ANIMAL_INTERACT_FALSE = new AnimalInteractFlag(false); private AnimalInteractFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_ANIMAL_INTERACT); + super(value, TranslatableCaption.of("flags.flag_description_animal_interact")); } @Override protected AnimalInteractFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockBurnFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockBurnFlag.java index c28387c40..4ea9696dd 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockBurnFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockBurnFlag.java @@ -26,6 +26,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +37,7 @@ public class BlockBurnFlag extends BooleanFlag { public static final BlockBurnFlag BLOCK_BURN_FALSE = new BlockBurnFlag(false); private BlockBurnFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_BLOCK_BURN); + super(value, TranslatableCaption.of("flags.flag_description_block_burn")); } @Override protected BlockBurnFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockIgnitionFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockIgnitionFlag.java index 7c708cb09..9b6275afe 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockIgnitionFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockIgnitionFlag.java @@ -26,6 +26,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +37,7 @@ public class BlockIgnitionFlag extends BooleanFlag { public static final BlockIgnitionFlag BLOCK_IGNITION_FALSE = new BlockIgnitionFlag(false); private BlockIgnitionFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_BLOCK_IGNITION); + super(value, TranslatableCaption.of("flags.flag_description_block_ignition")); } @Override protected BlockIgnitionFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockedCmdsFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockedCmdsFlag.java index 5c916d933..c0e1cad02 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockedCmdsFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BlockedCmdsFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.types.ListFlag; @@ -40,8 +40,8 @@ public class BlockedCmdsFlag extends ListFlag { new BlockedCmdsFlag(Collections.emptyList()); protected BlockedCmdsFlag(List valueList) { - super(valueList, Captions.FLAG_CATEGORY_STRING_LIST, - Captions.FLAG_DESCRIPTION_BLOCKED_CMDS); + super(valueList, TranslatableCaption.of("flags.flag_category_string_list"), + TranslatableCaption.of("flags.flag_description_blocked_cmds")); } @Override public BlockedCmdsFlag parse(@Nonnull String input) throws FlagParseException { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BreakFlag.java index 435d2143c..4761aadbb 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/BreakFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BlockTypeListFlag; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; @@ -38,7 +38,7 @@ public class BreakFlag extends BlockTypeListFlag { public static final BreakFlag BREAK_NONE = new BreakFlag(Collections.emptyList()); protected BreakFlag(List blockTypeList) { - super(blockTypeList, Captions.FLAG_DESCRIPTION_BREAK); + super(blockTypeList, TranslatableCaption.of("flags.flag_description_break")); } @Override protected BreakFlag flagOf(@Nonnull List value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java index 9114788b9..164b98cca 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ChatFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class ChatFlag extends BooleanFlag { public static final ChatFlag CHAT_FLAG_FALSE = new ChatFlag(false); protected ChatFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_CHAT); + super(value, TranslatableCaption.of("flags.flag_description_chat")); } @Override protected ChatFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/CoralDryFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/CoralDryFlag.java index 595cc8d74..41de8b5a1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/CoralDryFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/CoralDryFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class CoralDryFlag extends BooleanFlag { public static final CoralDryFlag CORAL_DRY_FALSE = new CoralDryFlag(false); private CoralDryFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_CORAL_DRY); + super(value, TranslatableCaption.of("flags.flag_description_coral_dry")); } @Override protected CoralDryFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyExitFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyExitFlag.java index 107cc360d..d0a32b4ef 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyExitFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyExitFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class DenyExitFlag extends BooleanFlag { public static final DenyExitFlag DENY_EXIT_FLAG_FALSE = new DenyExitFlag(false); protected DenyExitFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_DENY_EXIT); + super(value, TranslatableCaption.of("flags.flag_description_deny_exit")); } @Override protected DenyExitFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java index afd048335..56c73fb14 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java @@ -25,11 +25,12 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -47,7 +48,7 @@ public class DenyTeleportFlag extends PlotFlag { public static final DescriptionFlag DESCRIPTION_FLAG_EMPTY = new DescriptionFlag(""); protected DescriptionFlag(@Nonnull String value) { - super(value, Captions.FLAG_CATEGORY_STRING, Captions.FLAG_DESCRIPTION_DESCRIPTION); + super(value, TranslatableCaption.of("flags.flag_category_string"), TranslatableCaption.of("flags.flag_description_description")); } @Override public DescriptionFlag parse(@Nonnull String input) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DeviceInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DeviceInteractFlag.java index 6500c33ea..a83bc43df 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DeviceInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DeviceInteractFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class DeviceInteractFlag extends BooleanFlag { public static final DeviceInteractFlag DEVICE_INTERACT_FALSE = new DeviceInteractFlag(false); private DeviceInteractFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_DEVICE_INTERACT); + super(value, TranslatableCaption.of("flags.flag_description_device_interact")); } @Override protected DeviceInteractFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DisablePhysicsFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DisablePhysicsFlag.java index f4693bcb2..3abe1353b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DisablePhysicsFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DisablePhysicsFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class DisablePhysicsFlag extends BooleanFlag { public static final DisablePhysicsFlag DISABLE_PHYSICS_FALSE = new DisablePhysicsFlag(false); private DisablePhysicsFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_DISABLE_PHYSICS); + super(value, TranslatableCaption.of("flags.flag_description_disable_physics")); } @Override protected DisablePhysicsFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java index e1273654d..1d2191de2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DoneFlag.java @@ -26,6 +26,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.InternalFlag; import com.plotsquared.core.plot.flag.PlotFlag; @@ -40,7 +41,7 @@ public class DoneFlag extends PlotFlag implements InternalFlag * @param value Flag value */ public DoneFlag(@Nonnull String value) { - super(value, Captions.NONE, Captions.NONE); + super(value, TranslatableCaption.of("info.none"), TranslatableCaption.of("info.none")); } public static boolean isDone(final Plot plot) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DropProtectionFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DropProtectionFlag.java index 07d444838..b24b06b6d 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DropProtectionFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DropProtectionFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class DropProtectionFlag extends BooleanFlag { public static final DropProtectionFlag DROP_PROTECTION_FALSE = new DropProtectionFlag(false); private DropProtectionFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_DROP_PROTECTION); + super(value, TranslatableCaption.of("flags.flag_description_drop_protection")); } @Override protected DropProtectionFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityCapFlag.java index 3ed36a55c..b7fbe9738 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/EntityCapFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; import javax.annotation.Nonnull; @@ -34,7 +34,7 @@ public class EntityCapFlag extends NonNegativeIntegerFlag { public static final EntityCapFlag ENTITY_CAP_UNLIMITED = new EntityCapFlag(Integer.MAX_VALUE); protected EntityCapFlag(int value) { - super(value, Captions.FLAG_DESCRIPTION_ENTITY_CAP); + super(value, TranslatableCaption.of("flags.flag_description_entity_cap")); } @Override protected EntityCapFlag flagOf(@Nonnull Integer value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ExplosionFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ExplosionFlag.java index 7f80a7714..ab949c82a 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ExplosionFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ExplosionFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class ExplosionFlag extends BooleanFlag { public static final ExplosionFlag EXPLOSION_FALSE = new ExplosionFlag(false); private ExplosionFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_EXPLOSION); + super(value, TranslatableCaption.of("flags.flag_description_explosion")); } @Override protected ExplosionFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FarewellFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FarewellFlag.java index 9e751a678..d7c25e198 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FarewellFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FarewellFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.PlotFlag; import javax.annotation.Nonnull; @@ -35,7 +35,7 @@ public class FarewellFlag extends PlotFlag { public static final FarewellFlag FAREWELL_FLAG_EMPTY = new FarewellFlag(""); protected FarewellFlag(@Nonnull String value) { - super(value, Captions.FLAG_CATEGORY_STRING, Captions.FLAG_DESCRIPTION_FAREWELL); + super(value, TranslatableCaption.of("flags.flag_category_string"), TranslatableCaption.of("flags.flag_description_farewell")); } @Override public FarewellFlag parse(@Nonnull String input) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java index 495122293..d0355b486 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java @@ -25,9 +25,10 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.types.TimedFlag; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; @@ -35,7 +36,7 @@ public class FeedFlag extends TimedFlag { public static final FeedFlag FEED_NOTHING = new FeedFlag(new Timed<>(0, 0)); public FeedFlag(@Nonnull Timed value) { - super(value, 1, Captions.FLAG_DESCRIPTION_FEED); + super(value, 1, TranslatableCaption.of("flags.flag_description_feed")); } @Override protected Integer parseValue(String input) throws FlagParseException { @@ -43,10 +44,10 @@ public class FeedFlag extends TimedFlag { try { parsed = Integer.parseInt(input); } catch (Throwable throwable) { - throw new FlagParseException(this, input, Captions.NOT_A_NUMBER, input); + throw new FlagParseException(this, input, TranslatableCaption.of("invalid.not_a_number"), Template.of("value", input)); } if (parsed < 1) { - throw new FlagParseException(this, input, Captions.NUMBER_NOT_POSITIVE, parsed); + throw new FlagParseException(this, input, TranslatableCaption.of("invalid.number_not_positive"), Template.of("value", String.valueOf(parsed))); } return parsed; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java index 70fcfbf28..8893d00da 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FlyFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.PlotFlag; import javax.annotation.Nonnull; @@ -39,7 +39,7 @@ public class FlyFlag extends PlotFlag { public static final FlyFlag FLIGHT_FLAG_DEFAULT = new FlyFlag(FlyStatus.DEFAULT); protected FlyFlag(final FlyStatus value) { - super(value, Captions.FLAG_CATEGORY_BOOLEAN, Captions.FLAG_DESCRIPTION_FLIGHT); + super(value, TranslatableCaption.of("flags.flag_category_boolean"), TranslatableCaption.of("flags.flag_description_flight")); } @Override public FlyFlag parse(@Nonnull final String input) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ForcefieldFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ForcefieldFlag.java index 107a24c07..cbb3d70be 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ForcefieldFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ForcefieldFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class ForcefieldFlag extends BooleanFlag { public static final ForcefieldFlag FORCEFIELD_FALSE = new ForcefieldFlag(false); private ForcefieldFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_FORCEFIELD); + super(value, TranslatableCaption.of("flags.flag_description_forcefield")); } @Override protected ForcefieldFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GamemodeFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GamemodeFlag.java index 8dfba1761..a9306ca03 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GamemodeFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GamemodeFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; import com.sk89q.worldedit.world.gamemode.GameMode; @@ -54,7 +54,7 @@ public class GamemodeFlag extends PlotFlag { * @param value Flag value */ protected GamemodeFlag(@Nonnull GameMode value) { - super(value, Captions.FLAG_CATEGORY_GAMEMODE, Captions.FLAG_DESCRIPTION_GAMEMODE); + super(value, TranslatableCaption.of("flags.flag_category_gamemode"), TranslatableCaption.of("flags.flag_description_gamemode")); } @Override public GamemodeFlag parse(@Nonnull String input) throws FlagParseException { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GrassGrowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GrassGrowFlag.java index 4747e6157..4d8e1104a 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GrassGrowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GrassGrowFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class GrassGrowFlag extends BooleanFlag { public static final GrassGrowFlag GRASS_GROW_FALSE = new GrassGrowFlag(false); private GrassGrowFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_GRASS_GROW); + super(value, TranslatableCaption.of("flags.flag_description_grass_grow")); } @Override protected GrassGrowFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java index d1cd9020a..2c491eaa0 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.PlotFlag; import javax.annotation.Nonnull; @@ -35,7 +35,7 @@ public class GreetingFlag extends PlotFlag { public static final GreetingFlag GREETING_FLAG_EMPTY = new GreetingFlag(""); protected GreetingFlag(@Nonnull String value) { - super(value, Captions.FLAG_CATEGORY_STRING, Captions.FLAG_DESCRIPTION_GREETING); + super(value, TranslatableCaption.of("flags.flag_category_string"), TranslatableCaption.of("flags.flag_description_greeting")); } @Override public GreetingFlag parse(@Nonnull String input) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GuestGamemodeFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GuestGamemodeFlag.java index e4a3f546e..ed748d9f6 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GuestGamemodeFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GuestGamemodeFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; import com.sk89q.worldedit.world.gamemode.GameMode; @@ -52,7 +52,7 @@ public class GuestGamemodeFlag extends PlotFlag { * @param value Flag value */ protected GuestGamemodeFlag(@Nonnull GameMode value) { - super(value, Captions.FLAG_CATEGORY_GAMEMODE, Captions.FLAG_DESCRIPTION_GUEST_GAMEMODE); + super(value, TranslatableCaption.of("flags.flag_category_gamemode"), TranslatableCaption.of("flags.flag_description_guest_gamemode")); } @Override public GuestGamemodeFlag parse(@Nonnull String input) throws FlagParseException { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingBreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingBreakFlag.java index bcbccd675..f0e0971f3 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingBreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingBreakFlag.java @@ -26,6 +26,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +37,7 @@ public class HangingBreakFlag extends BooleanFlag { public static final HangingBreakFlag HANGING_BREAK_FALSE = new HangingBreakFlag(false); private HangingBreakFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_HANGING_BREAK); + super(value, TranslatableCaption.of("flags.flag_description_hanging_break")); } @Override protected HangingBreakFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingPlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingPlaceFlag.java index fd5c47730..5e4eeff32 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingPlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HangingPlaceFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class HangingPlaceFlag extends BooleanFlag { public static final HangingPlaceFlag HANGING_PLACE_FALSE = new HangingPlaceFlag(false); private HangingPlaceFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_HANGING_PLACE); + super(value, TranslatableCaption.of("flags.flag_description_hanging_place")); } @Override protected HangingPlaceFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java index d53ceaeb7..38df05e3d 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java @@ -26,8 +26,10 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.types.TimedFlag; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; @@ -35,7 +37,7 @@ public class HealFlag extends TimedFlag { public static final HealFlag HEAL_NOTHING = new HealFlag(new Timed<>(0, 0)); protected HealFlag(@Nonnull Timed value) { - super(value, 1, Captions.FLAG_DESCRIPTION_HEAL); + super(value, 1, TranslatableCaption.of("flags.flag_description_heal")); } @Override protected Integer parseValue(String input) throws FlagParseException { @@ -43,10 +45,10 @@ public class HealFlag extends TimedFlag { try { parsed = Integer.parseInt(input); } catch (Throwable throwable) { - throw new FlagParseException(this, input, Captions.NOT_A_NUMBER, input); + throw new FlagParseException(this, input, TranslatableCaption.of("invalid.not_a_number"), Template.of("value", input)); } if (parsed < 1) { - throw new FlagParseException(this, input, Captions.NUMBER_NOT_POSITIVE, parsed); + throw new FlagParseException(this, input, TranslatableCaption.of("invalid.number_not_positive"), Template.of("value", String.valueOf(parsed))); } return parsed; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HideInfoFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HideInfoFlag.java index 260eca55a..817a73c59 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HideInfoFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HideInfoFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class HideInfoFlag extends BooleanFlag { public static final HideInfoFlag HIDE_INFO_FALSE = new HideInfoFlag(false); private HideInfoFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_HIDE_INFO); + super(value, TranslatableCaption.of("flags.flag_description_hide_info")); } @Override protected HideInfoFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileAttackFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileAttackFlag.java index 1548d2974..3378734ec 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileAttackFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileAttackFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class HostileAttackFlag extends BooleanFlag { public static final HostileAttackFlag HOSTILE_ATTACK_FALSE = new HostileAttackFlag(false); private HostileAttackFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_HOSTILE_ATTACK); + super(value, TranslatableCaption.of("flags.flag_description_hostile_attack")); } @Override protected HostileAttackFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileCapFlag.java index dc2ea8a4b..695c07dc0 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileCapFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; import javax.annotation.Nonnull; @@ -35,7 +35,7 @@ public class HostileCapFlag extends NonNegativeIntegerFlag { new HostileCapFlag(Integer.MAX_VALUE); protected HostileCapFlag(int value) { - super(value, Captions.FLAG_DESCRIPTION_HOSTILE_CAP); + super(value, TranslatableCaption.of("flags.flag_description_hostile_cap")); } @Override protected HostileCapFlag flagOf(@Nonnull Integer value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileInteractFlag.java index 38f84f682..6e14bcb4a 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HostileInteractFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class HostileInteractFlag extends BooleanFlag { public static final HostileInteractFlag HOSTILE_INTERACT_FALSE = new HostileInteractFlag(false); private HostileInteractFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_HOSTILE_INTERACT); + super(value, TranslatableCaption.of("flags.flag_description_hostile_interact")); } @Override protected HostileInteractFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceFormFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceFormFlag.java index 1a28e114c..cc1db50a4 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceFormFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceFormFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class IceFormFlag extends BooleanFlag { public static final IceFormFlag ICE_FORM_FALSE = new IceFormFlag(false); private IceFormFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_ICE_FORM); + super(value, TranslatableCaption.of("flags.flag_description_ice_form")); } @Override protected IceFormFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceMeltFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceMeltFlag.java index a6ee3f00b..80154abfb 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceMeltFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/IceMeltFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class IceMeltFlag extends BooleanFlag { public static final IceMeltFlag ICE_MELT_FALSE = new IceMeltFlag(false); private IceMeltFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_ICE_MELT); + super(value, TranslatableCaption.of("flags.flag_description_ice_melt")); } @Override protected IceMeltFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InstabreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InstabreakFlag.java index 831dd8255..3e2cfc4bf 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InstabreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InstabreakFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class InstabreakFlag extends BooleanFlag { public static final InstabreakFlag INSTABREAK_FALSE = new InstabreakFlag(false); private InstabreakFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_INSTABREAK); + super(value, TranslatableCaption.of("flags.flag_description_instabreak")); } @Override protected InstabreakFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InvincibleFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InvincibleFlag.java index 832c2ea01..524db44ce 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InvincibleFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/InvincibleFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class InvincibleFlag extends BooleanFlag { public static final InvincibleFlag INVINCIBLE_FALSE = new InvincibleFlag(false); private InvincibleFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_INVINCIBLE); + super(value, TranslatableCaption.of("flags.flag_description_invincible")); } @Override protected InvincibleFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ItemDropFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ItemDropFlag.java index e292c8df8..068a140a2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ItemDropFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ItemDropFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class ItemDropFlag extends BooleanFlag { public static final ItemDropFlag ITEM_DROP_FALSE = new ItemDropFlag(false); private ItemDropFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_ITEM_DROP); + super(value, TranslatableCaption.of("flags.flag_description_item_drop")); } @Override protected ItemDropFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java index d4a1b263b..8b55fbe6b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.util.MathMan; @@ -43,14 +43,14 @@ public class KeepFlag extends PlotFlag { * @param value Flag value */ protected KeepFlag(@Nonnull Object value) { - super(value, Captions.FLAG_CATEGORY_MIXED, Captions.FLAG_DESCRIPTION_KEEP); + super(value, TranslatableCaption.of("flags.flag_category_mixed"), TranslatableCaption.of("flags.flag_description_keep")); } @Override public KeepFlag parse(@Nonnull String input) throws FlagParseException { if (MathMan.isInteger(input)) { final long value = Long.parseLong(input); if (value < 0) { - throw new FlagParseException(this, input, Captions.FLAG_ERROR_KEEP); + throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_keep")); } else { return flagOf(value); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepInventoryFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepInventoryFlag.java index fca69a1e3..bb83252c1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepInventoryFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepInventoryFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class KeepInventoryFlag extends BooleanFlag { public static final KeepInventoryFlag KEEP_INVENTORY_FALSE = new KeepInventoryFlag(false); private KeepInventoryFlag(final boolean value) { - super(value, Captions.FLAG_DESCRIPTION_KEEP_INVENTORY); + super(value, TranslatableCaption.of("flags.flag_description_keep_inventory")); } @Override protected KeepInventoryFlag flagOf(@Nonnull final Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KelpGrowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KelpGrowFlag.java index e2e972a3e..371db5ff9 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KelpGrowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KelpGrowFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class KelpGrowFlag extends BooleanFlag { public static final KelpGrowFlag KELP_GROW_FALSE = new KelpGrowFlag(false); private KelpGrowFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_KELP_GROW); + super(value, TranslatableCaption.of("flags.flag_description_kelp_grow")); } @Override protected KelpGrowFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/LiquidFlowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/LiquidFlowFlag.java index ed06554b9..888ca171c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/LiquidFlowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/LiquidFlowFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.PlotFlag; import javax.annotation.Nonnull; @@ -40,7 +40,7 @@ public class LiquidFlowFlag extends PlotFlag { public static final MiscBreakFlag MISC_BREAK_FALSE = new MiscBreakFlag(false); private MiscBreakFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_MISC_BREAK); + super(value, TranslatableCaption.of("flags.flag_description_misc_break")); } @Override protected MiscBreakFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscCapFlag.java index 39c795250..6132593e2 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscCapFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; import javax.annotation.Nonnull; @@ -34,7 +34,7 @@ public class MiscCapFlag extends NonNegativeIntegerFlag { public static final MiscCapFlag MISC_CAP_UNLIMITED = new MiscCapFlag(Integer.MAX_VALUE); protected MiscCapFlag(int value) { - super(value, Captions.FLAG_DESCRIPTION_MISC_CAP); + super(value, TranslatableCaption.of("flags.flag_description_misc_cap")); } @Override protected MiscCapFlag flagOf(@Nonnull Integer value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscInteractFlag.java index 4c002f51b..120b7b5b1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscInteractFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class MiscInteractFlag extends BooleanFlag { public static final MiscInteractFlag MISC_INTERACT_FALSE = new MiscInteractFlag(false); private MiscInteractFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_MISC_INTERACT); + super(value, TranslatableCaption.of("flags.flag_description_misc_interact")); } @Override protected MiscInteractFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscPlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscPlaceFlag.java index 8c2d3b2e5..760f56e10 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscPlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MiscPlaceFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class MiscPlaceFlag extends BooleanFlag { public static final MiscPlaceFlag MISC_PLACE_FALSE = new MiscPlaceFlag(false); private MiscPlaceFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_MISC_PLACE); + super(value, TranslatableCaption.of("flags.flag_description_misc_place")); } @Override protected MiscPlaceFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobBreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobBreakFlag.java index 45f4fba54..c88ac6b87 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobBreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobBreakFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class MobBreakFlag extends BooleanFlag { public static final MobBreakFlag MOB_BREAK_FALSE = new MobBreakFlag(false); private MobBreakFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_MOB_BREAK); + super(value, TranslatableCaption.of("flags.flag_description_mob_break")); } @Override protected MobBreakFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobCapFlag.java index 01ecfd319..77a7055d1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobCapFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; import javax.annotation.Nonnull; @@ -34,7 +34,7 @@ public class MobCapFlag extends NonNegativeIntegerFlag { public static final MobCapFlag MOB_CAP_UNLIMITED = new MobCapFlag(Integer.MAX_VALUE); protected MobCapFlag(int value) { - super(value, Captions.FLAG_DESCRIPTION_MOB_CAP); + super(value, TranslatableCaption.of("flags.flag_description_mob_cap")); } @Override protected MobCapFlag flagOf(@Nonnull Integer value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobPlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobPlaceFlag.java index 2385e2d66..d8c62730b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobPlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MobPlaceFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class MobPlaceFlag extends BooleanFlag { public static final MobPlaceFlag MOB_PLACE_FALSE = new MobPlaceFlag(false); private MobPlaceFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_MOB_PLACE); + super(value, TranslatableCaption.of("flags.flag_description_mob_place")); } @Override protected MobPlaceFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java index ef1fcfc67..9db7aae7c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MusicFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.util.ItemUtil; @@ -44,7 +44,7 @@ public class MusicFlag extends PlotFlag { * @param value Flag value */ protected MusicFlag(ItemType value) { - super(value, Captions.FLAG_CATEGORY_MUSIC, Captions.FLAG_DESCRIPTION_MUSIC); + super(value, TranslatableCaption.of("flags.flag_category_music"), TranslatableCaption.of("flags.flag_description_music")); } @Override public MusicFlag parse(@Nonnull String input) throws FlagParseException { @@ -56,7 +56,7 @@ public class MusicFlag extends PlotFlag { .getId().contains("music_disc_"))) { return new MusicFlag(ItemUtil.get(input)); } else { - throw new FlagParseException(this, input, Captions.FLAG_ERROR_MUSIC); + throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_music")); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MycelGrowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MycelGrowFlag.java index dcb70bb21..69283b7ec 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MycelGrowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/MycelGrowFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class MycelGrowFlag extends BooleanFlag { public static final MycelGrowFlag MYCEL_GROW_FALSE = new MycelGrowFlag(false); private MycelGrowFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_MYCEL_GROW); + super(value, TranslatableCaption.of("flags.flag_description_mycel_grow")); } @Override protected MycelGrowFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NoWorldeditFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NoWorldeditFlag.java index 5bf272d41..2af364898 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NoWorldeditFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NoWorldeditFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class NoWorldeditFlag extends BooleanFlag { public static final NoWorldeditFlag NO_WORLDEDIT_FALSE = new NoWorldeditFlag(false); private NoWorldeditFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_NO_WORLDEDIT); + super(value, TranslatableCaption.of("flags.flag_description_no_worldedit")); } @Override protected NoWorldeditFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyEnterFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyEnterFlag.java index db9b31afa..749446dfd 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyEnterFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyEnterFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class NotifyEnterFlag extends BooleanFlag { public static final NotifyEnterFlag NOTIFY_ENTER_FALSE = new NotifyEnterFlag(false); private NotifyEnterFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_NOTIFY_ENTER); + super(value, TranslatableCaption.of("flags.flag_description_notify_enter")); } @Override protected NotifyEnterFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyLeaveFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyLeaveFlag.java index ea57ddf6d..159b47ea3 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyLeaveFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/NotifyLeaveFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class NotifyLeaveFlag extends BooleanFlag { public static final NotifyLeaveFlag NOTIFY_LEAVE_FALSE = new NotifyLeaveFlag(false); private NotifyLeaveFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_NOTIFY_LEAVE); + super(value, TranslatableCaption.of("flags.flag_description_notify_leave")); } @Override protected NotifyLeaveFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlaceFlag.java index 106ea6bb5..560667bd1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlaceFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BlockTypeListFlag; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; @@ -38,7 +38,7 @@ public class PlaceFlag extends BlockTypeListFlag { public static final PlaceFlag PLACE_NONE = new PlaceFlag(Collections.emptyList()); protected PlaceFlag(List blockTypeList) { - super(blockTypeList, Captions.FLAG_DESCRIPTION_PLACE); + super(blockTypeList, TranslatableCaption.of("flags.flag_description_place")); } @Override protected PlaceFlag flagOf(@Nonnull List value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlayerInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlayerInteractFlag.java index f50bf9156..993973b8c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlayerInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PlayerInteractFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class PlayerInteractFlag extends BooleanFlag { public static final PlayerInteractFlag PLAYER_INTERACT_FALSE = new PlayerInteractFlag(false); private PlayerInteractFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_PLAYER_INTERACT); + super(value, TranslatableCaption.of("flags.flag_description_player_interact")); } @Override protected PlayerInteractFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PreventCreativeCopyFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PreventCreativeCopyFlag.java index 57139054a..a57538e31 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PreventCreativeCopyFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PreventCreativeCopyFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -38,7 +38,7 @@ public class PreventCreativeCopyFlag extends BooleanFlag { public static final PriceFlag PRICE_NOT_BUYABLE = new PriceFlag(0D); protected PriceFlag(@Nonnull Double value) { - super(value, Double.MIN_NORMAL, Double.MAX_VALUE, Captions.FLAG_DESCRIPTION_PRICE); + super(value, Double.MIN_NORMAL, Double.MAX_VALUE, TranslatableCaption.of("flags.flag_description_price")); } @Override protected PriceFlag flagOf(@Nonnull Double value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PveFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PveFlag.java index d0222e790..dfb8d8a1e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PveFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PveFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class PveFlag extends BooleanFlag { public static final PveFlag PVE_FALSE = new PveFlag(false); private PveFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_PVE); + super(value, TranslatableCaption.of("flags.flag_description_pve")); } @Override protected PveFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PvpFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PvpFlag.java index 0699d57cf..451382313 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PvpFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/PvpFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class PvpFlag extends BooleanFlag { public static final PvpFlag PVP_FALSE = new PvpFlag(false); private PvpFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_PVP); + super(value, TranslatableCaption.of("flags.flag_description_pvp")); } @Override protected PvpFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/RedstoneFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/RedstoneFlag.java index 1fcefa066..7df17bb34 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/RedstoneFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/RedstoneFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class RedstoneFlag extends BooleanFlag { public static final RedstoneFlag REDSTONE_FALSE = new RedstoneFlag(false); private RedstoneFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_REDSTONE); + super(value, TranslatableCaption.of("flags.flag_description_redstone")); } @Override protected RedstoneFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ServerPlotFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ServerPlotFlag.java index a6af472a5..f576579b1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ServerPlotFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/ServerPlotFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class ServerPlotFlag extends BooleanFlag { public static final ServerPlotFlag SERVER_PLOT_FALSE = new ServerPlotFlag(false); private ServerPlotFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_SERVER_PLOT); + super(value, TranslatableCaption.of("flags.flag_description_server_plot")); } @Override protected ServerPlotFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowFormFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowFormFlag.java index 25df819f4..9debb6c70 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowFormFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowFormFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class SnowFormFlag extends BooleanFlag { public static final SnowFormFlag SNOW_FORM_FALSE = new SnowFormFlag(false); private SnowFormFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_SNOW_FORM); + super(value, TranslatableCaption.of("flags.flag_description_snow_for")); } @Override protected SnowFormFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowMeltFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowMeltFlag.java index 8f4ed2817..632045579 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowMeltFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SnowMeltFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class SnowMeltFlag extends BooleanFlag { public static final SnowMeltFlag SNOW_MELT_FALSE = new SnowMeltFlag(false); private SnowMeltFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_SNOW_MELT); + super(value, TranslatableCaption.of("flags.flag_description_snow_melt")); } @Override protected SnowMeltFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SoilDryFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SoilDryFlag.java index b40b3d442..8b2ed6496 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SoilDryFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/SoilDryFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class SoilDryFlag extends BooleanFlag { public static final SoilDryFlag SOIL_DRY_FALSE = new SoilDryFlag(false); private SoilDryFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_SOIL_DRY); + super(value, TranslatableCaption.of("flags.flag_description_soil_dry")); } @Override protected SoilDryFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedAttackFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedAttackFlag.java index 1161c5fe2..305b1d503 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedAttackFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedAttackFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class TamedAttackFlag extends BooleanFlag { public static final TamedAttackFlag TAMED_ATTACK_FALSE = new TamedAttackFlag(false); private TamedAttackFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_TAMED_ATTACK); + super(value, TranslatableCaption.of("flags.flag_description_tamed_attack")); } @Override protected TamedAttackFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedInteractFlag.java index b4d2e8b44..34320bfd9 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TamedInteractFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class TamedInteractFlag extends BooleanFlag { public static final TamedInteractFlag TAMED_INTERACT_FALSE = new TamedInteractFlag(false); private TamedInteractFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_TAMED_INTERACT); + super(value, TranslatableCaption.of("flags.flag_description_tamed_interact")); } @Override protected TamedInteractFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TimeFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TimeFlag.java index 700e56a76..cd935f0ce 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TimeFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TimeFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.LongFlag; import javax.annotation.Nonnull; @@ -34,7 +34,7 @@ public class TimeFlag extends LongFlag { public static final TimeFlag TIME_DISABLED = new TimeFlag(Long.MIN_VALUE); protected TimeFlag(@Nonnull Long value) { - super(value, Captions.FLAG_DESCRIPTION_TIME); + super(value, TranslatableCaption.of("flags.flag_description_time")); } @Override protected TimeFlag flagOf(@Nonnull Long value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java index bf521ff40..17f36f9dd 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java @@ -25,9 +25,10 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -42,14 +43,13 @@ public class TitlesFlag extends PlotFlag public static final TitlesFlag TITLES_FALSE = new TitlesFlag(TitlesFlagValue.FALSE); private TitlesFlag(final TitlesFlagValue value) { - super(value, Captions.FLAG_CATEGORY_ENUM, Captions.FLAG_DESCRIPTION_TITLES); + super(value, TranslatableCaption.of("flags.flag_category_enum"), TranslatableCaption.of("flags.flag_description_titles")); } @Override public TitlesFlag parse(@Nonnull final String input) throws FlagParseException { final TitlesFlagValue titlesFlagValue = TitlesFlagValue.fromString(input); if (titlesFlagValue == null) { - throw new FlagParseException(this, input, Captions.FLAG_ERROR_ENUM, - Arrays.asList("none", "true", "false")); + throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_enum"), Template.of("list", "none, true, false")); } return flagOf(titlesFlagValue); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UntrustedVisitFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UntrustedVisitFlag.java index 37804030f..4e976e7cc 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UntrustedVisitFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UntrustedVisitFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -35,7 +35,7 @@ public class UntrustedVisitFlag extends BooleanFlag { public static final UntrustedVisitFlag UNTRUSTED_VISIT_FLAG_TRUE = new UntrustedVisitFlag(true); protected UntrustedVisitFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_UNTRUSTED); + super(value, TranslatableCaption.of("flags.flag_description_untrusted")); } @Override protected UntrustedVisitFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UseFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UseFlag.java index 7b8306201..d809b6a09 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UseFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/UseFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BlockTypeListFlag; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; @@ -38,7 +38,7 @@ public class UseFlag extends BlockTypeListFlag { public static final UseFlag USE_NONE = new UseFlag(Collections.emptyList()); protected UseFlag(List blockTypeList) { - super(blockTypeList, Captions.FLAG_DESCRIPTION_USE); + super(blockTypeList, TranslatableCaption.of("flags.flag_description_use")); } @Override protected UseFlag flagOf(@Nonnull List value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleBreakFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleBreakFlag.java index fc0575d7b..ddfedeb2e 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleBreakFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleBreakFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class VehicleBreakFlag extends BooleanFlag { public static final VehicleBreakFlag VEHICLE_BREAK_FALSE = new VehicleBreakFlag(false); private VehicleBreakFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_VEHICLE_BREAK); + super(value, TranslatableCaption.of("flags.flag_description_vehicle_break")); } @Override protected VehicleBreakFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleCapFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleCapFlag.java index cc159f3d9..9eebe6bba 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleCapFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleCapFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.NonNegativeIntegerFlag; import javax.annotation.Nonnull; @@ -35,7 +35,7 @@ public class VehicleCapFlag extends NonNegativeIntegerFlag { new VehicleCapFlag(Integer.MAX_VALUE); protected VehicleCapFlag(int value) { - super(value, Captions.FLAG_DESCRIPTION_VEHICLE_CAP); + super(value, TranslatableCaption.of("flags.flag_description_vehicle_cap")); } @Override protected VehicleCapFlag flagOf(@Nonnull Integer value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehiclePlaceFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehiclePlaceFlag.java index bc41a3201..9ee775eaa 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehiclePlaceFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehiclePlaceFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class VehiclePlaceFlag extends BooleanFlag { public static final VehiclePlaceFlag VEHICLE_PLACE_FALSE = new VehiclePlaceFlag(false); private VehiclePlaceFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_VEHICLE_PLACE); + super(value, TranslatableCaption.of("flags.flag_description_vehicle_place")); } @Override protected VehiclePlaceFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleUseFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleUseFlag.java index 91630c4e7..c7d6de969 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleUseFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VehicleUseFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class VehicleUseFlag extends BooleanFlag { public static final VehicleUseFlag VEHICLE_USE_FALSE = new VehicleUseFlag(false); private VehicleUseFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_VEHICLE_USE); + super(value, TranslatableCaption.of("flags.flag_description_vehicle_use")); } @Override protected VehicleUseFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VillagerInteractFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VillagerInteractFlag.java index cef044da8..0c8922da5 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VillagerInteractFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VillagerInteractFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -38,7 +38,7 @@ public class VillagerInteractFlag extends BooleanFlag { new VillagerInteractFlag(false); private VillagerInteractFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_VILLAGER_INTERACT); + super(value, TranslatableCaption.of("flags.flag_description_villager_interact")); } @Override protected VillagerInteractFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VineGrowFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VineGrowFlag.java index 3702a88df..a640f0677 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VineGrowFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/VineGrowFlag.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.plot.flag.implementations; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.types.BooleanFlag; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public class VineGrowFlag extends BooleanFlag { public static final VineGrowFlag VINE_GROW_FALSE = new VineGrowFlag(false); private VineGrowFlag(boolean value) { - super(value, Captions.FLAG_DESCRIPTION_VINE_GROW); + super(value, TranslatableCaption.of("flags.flag_description_vine_grow")); } @Override protected VineGrowFlag flagOf(@Nonnull Boolean value) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java index de9a12327..a4844aa58 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java @@ -26,6 +26,7 @@ package com.plotsquared.core.plot.flag.implementations; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.PlotWeather; import com.plotsquared.core.plot.flag.PlotFlag; @@ -45,7 +46,7 @@ public class WeatherFlag extends PlotFlag { * @param value Flag value */ protected WeatherFlag(@Nonnull PlotWeather value) { - super(value, Captions.FLAG_CATEGORY_WEATHER, Captions.FLAG_DESCRIPTION_WEATHER); + super(value, TranslatableCaption.of("flags.flag_category_weather"), TranslatableCaption.of("flags.flag_description_weather")); } @Override public WeatherFlag parse(@Nonnull String input) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java index a9a9282ff..196a80909 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeListFlag.java @@ -27,6 +27,7 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.util.BlockUtil; import com.sk89q.worldedit.world.block.BlockCategory; @@ -87,7 +88,7 @@ public abstract class BlockTypeListFlag> private BlockTypeWrapper getCategory(final String blockString) throws FlagParseException { if (!blockString.startsWith("#")) { - throw new FlagParseException(this, blockString, Captions.FLAG_ERROR_INVALID_BLOCK); + throw new FlagParseException(this, blockString, TranslatableCaption.of("flags.flag_error_invalid_block")); } String categoryId = blockString.substring(1); BlockTypeWrapper blockTypeWrapper; @@ -96,7 +97,7 @@ public abstract class BlockTypeListFlag> } else { BlockCategory blockCategory = BlockCategory.REGISTRY.get(categoryId); if (blockCategory == null) { - throw new FlagParseException(this, blockString, Captions.FLAG_ERROR_INVALID_BLOCK); + throw new FlagParseException(this, blockString, TranslatableCaption.of("flags.flag_error_invalid_block")); } blockTypeWrapper = BlockTypeWrapper.get(blockCategory); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BooleanFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BooleanFlag.java index 89b509886..1221c70e8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BooleanFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BooleanFlag.java @@ -27,6 +27,7 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; @@ -49,7 +50,7 @@ public abstract class BooleanFlag> extends PlotFl * @param description Flag description */ protected BooleanFlag(final boolean value, final Caption description) { - super(value, Captions.FLAG_CATEGORY_BOOLEAN, description); + super(value, TranslatableCaption.of("flags.flag_category_boolean"), description); } /** @@ -68,7 +69,7 @@ public abstract class BooleanFlag> extends PlotFl } else if (negativeValues.contains(input.toLowerCase(Locale.ENGLISH))) { return this.flagOf(false); } else { - throw new FlagParseException(this, input, Captions.FLAG_ERROR_BOOLEAN); + throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_boolean")); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/DoubleFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/DoubleFlag.java index 056a4c138..1ff102653 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/DoubleFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/DoubleFlag.java @@ -26,7 +26,7 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.caption.Caption; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import javax.annotation.Nonnull; @@ -35,7 +35,7 @@ public abstract class DoubleFlag> extends Number protected DoubleFlag(@Nonnull Double value, Double minimum, Double maximum, @Nonnull Caption flagDescription) { - super(value, minimum, maximum, Captions.FLAG_CATEGORY_DOUBLES, flagDescription); + super(value, minimum, maximum, TranslatableCaption.of("flags.flag_category_doubles"), flagDescription); } protected DoubleFlag(@Nonnull Double value, @Nonnull Caption flagDescription) { @@ -58,7 +58,7 @@ public abstract class DoubleFlag> extends Number try { return Double.parseDouble(input); } catch (Throwable throwable) { - throw new FlagParseException(this, input, Captions.FLAG_ERROR_DOUBLE); + throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_double")); } } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/IntegerFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/IntegerFlag.java index 14b3817ed..43ae4296c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/IntegerFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/IntegerFlag.java @@ -27,6 +27,7 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import javax.annotation.Nonnull; @@ -35,7 +36,7 @@ public abstract class IntegerFlag> extends Numb protected IntegerFlag(final int value, int minimum, int maximum, @Nonnull Caption flagDescription) { - super(value, minimum, maximum, Captions.FLAG_CATEGORY_INTEGERS, flagDescription); + super(value, minimum, maximum, TranslatableCaption.of("flags.flag_category_integers"), flagDescription); } protected IntegerFlag(@Nonnull Caption flagDescription) { @@ -58,7 +59,7 @@ public abstract class IntegerFlag> extends Numb try { return Integer.parseInt(input); } catch (Throwable throwable) { - throw new FlagParseException(this, input, Captions.FLAG_ERROR_INTEGER); + throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_integer")); } } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/LongFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/LongFlag.java index 34b8feb15..25415dec8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/LongFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/LongFlag.java @@ -26,8 +26,9 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.caption.Caption; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; @@ -35,7 +36,7 @@ public abstract class LongFlag> extends NumberFlag protected LongFlag(@Nonnull Long value, Long minimum, Long maximum, @Nonnull Caption flagDescription) { - super(value, minimum, maximum, Captions.FLAG_CATEGORY_INTEGERS, flagDescription); + super(value, minimum, maximum, TranslatableCaption.of("flags.flag_category_integers"), flagDescription); } protected LongFlag(@Nonnull Long value, @Nonnull Caption flagDescription) { @@ -58,7 +59,7 @@ public abstract class LongFlag> extends NumberFlag try { return Long.parseLong(input); } catch (Throwable throwable) { - throw new FlagParseException(this, input, Captions.NOT_A_NUMBER, input); + throw new FlagParseException(this, input, TranslatableCaption.of("invalid.not_a_number"), Template.of("value", input)); } } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/NumberFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/NumberFlag.java index 6f3ec45eb..841475609 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/NumberFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/NumberFlag.java @@ -26,7 +26,7 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.caption.Caption; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; @@ -51,7 +51,7 @@ public abstract class NumberFlag, F extends Plo @Override public F parse(@Nonnull String input) throws FlagParseException { final N parsed = parseNumber(input); if (parsed.compareTo(minimum) < 0 || parsed.compareTo(maximum) > 0) { - throw new FlagParseException(this, input, Captions.NUMBER_NOT_IN_RANGE, minimum, + throw new FlagParseException(this, input, TranslatableCaption.of("invalid.number_not_in_range"), minimum, maximum); } return flagOf(parsed); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/TimedFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/TimedFlag.java index 6001de241..e3d22dd49 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/TimedFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/TimedFlag.java @@ -26,9 +26,10 @@ package com.plotsquared.core.plot.flag.types; import com.plotsquared.core.configuration.caption.Caption; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.PlotFlag; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; @@ -37,7 +38,7 @@ public abstract class TimedFlag, F>> private final T defaultValue; protected TimedFlag(@Nonnull Timed value, T defaultValue, @Nonnull Caption flagDescription) { - super(value, Captions.FLAG_CATEGORY_INTERVALS, flagDescription); + super(value, TranslatableCaption.of("flags.flag_category_intervals"), flagDescription); this.defaultValue = defaultValue; } @@ -47,10 +48,10 @@ public abstract class TimedFlag, F>> try { interval = Integer.parseInt(split[0]); } catch (Throwable throwable) { - throw new FlagParseException(this, input, Captions.NOT_A_NUMBER, split[0]); + throw new FlagParseException(this, input, TranslatableCaption.of("invalid.not_a_number"), Template.of("value", split[0])); } if (interval < 1) { - throw new FlagParseException(this, input, Captions.NUMBER_NOT_POSITIVE, split[0]); + throw new FlagParseException(this, input, TranslatableCaption.of("invalid.number_not_positive"), Template.of("value", split[0])); } if (split.length == 1) { return flagOf(new Timed<>(interval, defaultValue)); diff --git a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java index a17eb416b..9916bfa69 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java +++ b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java @@ -281,11 +281,11 @@ public class EventDispatcher { case INTERACT_BLOCK: { if (plot == null) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); + Captions.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms); } if (!plot.hasOwner()) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms); } final List use = plot.getFlag(UseFlag.class); for (final BlockTypeWrapper blockTypeWrapper : use) { @@ -295,7 +295,7 @@ public class EventDispatcher { } } return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), + .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false) || !(!notifyPerms || MainUtil .sendMessage(player, Captions.FLAG_TUTORIAL_USAGE, Captions.FLAG_USE.getTranslated())); @@ -303,11 +303,11 @@ public class EventDispatcher { case TRIGGER_PHYSICAL: { if (plot == null) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), false); + Captions.PERMISSION_ADMIN_INTERACT_ROAD.toString(), false); } if (!plot.hasOwner()) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), false); + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), false); } if (plot.getFlag(DeviceInteractFlag.class)) { return true; @@ -320,17 +320,17 @@ public class EventDispatcher { } } return Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), + .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false); } case SPAWN_MOB: { if (plot == null) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); + Captions.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms); } if (!plot.hasOwner()) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms); } if (plot.getFlag(MobPlaceFlag.class)) { return true; @@ -343,7 +343,7 @@ public class EventDispatcher { } } if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), + .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false)) { return true; } @@ -354,11 +354,11 @@ public class EventDispatcher { case PLACE_MISC: { if (plot == null) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); + Captions.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms); } if (!plot.hasOwner()) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms); } if (plot.getFlag(MiscPlaceFlag.class)) { return true; @@ -371,7 +371,7 @@ public class EventDispatcher { } } if (Permissions - .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), + .hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false)) { return true; } @@ -382,11 +382,11 @@ public class EventDispatcher { case PLACE_VEHICLE: if (plot == null) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(), notifyPerms); + Captions.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms); } if (!plot.hasOwner()) { return Permissions.hasPermission(player, - Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(), notifyPerms); + Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms); } return plot.getFlag(VehiclePlaceFlag.class); default: diff --git a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java index b25a9465b..536420b7b 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java @@ -27,7 +27,7 @@ package com.plotsquared.core.util; import com.google.common.base.Preconditions; import com.plotsquared.core.command.Command; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.player.PlotPlayer; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; @@ -41,6 +41,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -88,7 +89,7 @@ public class PatternUtil { try { return WorldEdit.getInstance().getPatternFactory().parseFromInput(input, context); } catch (InputParseException e) { - throw new Command.CommandException(Captions.NOT_VALID_BLOCK, e.getMessage()); + throw new Command.CommandException(TranslatableCaption.of("invalid.not_valid_block"), Template.of("value", e.getMessage())); } } diff --git a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java index c45479bea..36950be18 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java @@ -28,6 +28,7 @@ package com.plotsquared.core.util; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.PlotPlayer; @@ -108,7 +109,7 @@ public abstract class PlayerManager

, T> { */ @Nonnull public static String getPlayerList(@Nonnull final Collection uuids) { if (uuids.size() < 1) { - return Captions.NONE.getTranslated(); + TranslatableCaption.of("info.none"); } final List players = new LinkedList<>(); @@ -165,13 +166,13 @@ public abstract class PlayerManager

, T> { */ @Nonnull public static String getName(@Nullable final UUID owner, final boolean blocking) { if (owner == null) { - return Captions.NONE.getTranslated(); + TranslatableCaption.of("info.none"); } if (owner.equals(DBFunc.EVERYONE)) { - return Captions.EVERYONE.getTranslated(); + TranslatableCaption.of("info.everyone"); } if (owner.equals(DBFunc.SERVER)) { - return Captions.SERVER.getTranslated(); + TranslatableCaption.of("info.server"); } final String name; if (blocking) { @@ -187,7 +188,7 @@ public abstract class PlayerManager

, T> { } } if (name == null) { - return Captions.UNKNOWN.getTranslated(); + TranslatableCaption.of("info.unknown"); } return name; } diff --git a/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java b/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java index 0e5c94be1..24bc71d8f 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java @@ -29,6 +29,7 @@ import com.google.common.collect.Lists; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.util.ThreadUtils; import com.plotsquared.core.util.task.TaskManager; import org.slf4j.Logger; @@ -330,7 +331,7 @@ public class UUIDPipeline { if (Settings.UUID.UNKNOWN_AS_DEFAULT) { for (final UUID uuid : remainingRequests) { - mappings.add(new UUIDMapping(uuid, Captions.UNKNOWN.getTranslated())); + mappings.add(new UUIDMapping(uuid, TranslatableCaption.of("info.unknown"))); } return mappings; } else { diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 8b2c2bc82..4525fa800 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -156,7 +156,7 @@ "plotareatype.plot_area_type_normal": "Standard plot generation", "plotareatype.plot_area_type_augmented": "Plot generation with vanilla terrain", "plotareatype.plot_area_type_partial": "Vanilla with clusters of plots", - + "schematics.schematic_too_large": "The plot is too large for this action!", "schematics.schematic_invalid": "That is not a valid schematic. Reason: .", "schematics.schematic_invalid_named": " is not a valid schematic. Reason: .", @@ -223,7 +223,7 @@ "commandconfig.flag_tutorial_usage": "Have an admin set the flag: ", "invalid.component_illegal_block": "You are not allowed to generate a component containing the block ", - "invalid.not_valid_block": "That's not a valid block: ", + "invalid.not_valid_block": "That's not a valid block: ", "invalid.not_allowed_block": "That block is not allowed: ", "invalid.not_valid_number": "That's not a valid number within the range: ", "invalid.not_valid_plot_id": "That's not a valid plot ID.", @@ -481,7 +481,7 @@ "legacyconfig.legacy_config_found": "A legacy configuration file was detected. Conversion will be attempted.", "legacyconfig.legacy_config_backup": "A copy of worlds.yml has been saved in the file worlds.yml.old.", - "legacyconfig.legacy_config_replaced": "> %s has been replaced with %s", + "legacyconfig.legacy_config_replaced": "> has been replaced with ", "legacyconfig.legacy_config_done": "The conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.", "legacyconfig.legacy_config_conversion_failed": "Failed to convert the legacy configuration file. See stack trace for information.",