From 8d04728ebc62f301c92c2924aac44d0482ecaab6 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Wed, 22 Jul 2020 00:08:51 +0200 Subject: [PATCH] More work --- .../plotsquared/core/command/DebugExec.java | 71 +++++++++++-------- .../core/command/DebugImportWorlds.java | 10 +-- .../plotsquared/core/command/DebugPaste.java | 38 +++++----- .../core/command/DebugRoadRegen.java | 60 ++++++++++------ .../core/command/DebugSaveTest.java | 5 +- .../com/plotsquared/core/command/Delete.java | 15 ++-- .../com/plotsquared/core/command/Deny.java | 32 ++++++--- .../com/plotsquared/core/command/Desc.java | 6 +- .../com/plotsquared/core/command/Done.java | 16 ++--- .../plotsquared/core/command/Download.java | 30 ++++---- .../com/plotsquared/core/command/Grant.java | 14 +++- .../plotsquared/core/command/HomeCommand.java | 26 +++++-- .../com/plotsquared/core/command/Inbox.java | 64 +++++++++++------ .../com/plotsquared/core/command/Info.java | 17 +++-- Core/src/main/resources/lang/messages_en.json | 47 ++++++++++-- 15 files changed, 297 insertions(+), 154 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java index 8ae7e2f99..7cfdf70c1 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -223,7 +223,7 @@ public class DebugExec extends SubCommand { if (analysis != null) { player.sendMessage( TranslatableCaption.of("debugexec.changes_column"), - Template.of("value", analysis.changes / 1.0) + Template.of("value", String.valueOf(analysis.changes / 1.0)) ); return true; } @@ -261,11 +261,13 @@ public class DebugExec extends SubCommand { if (ExpireManager.IMP == null || !ExpireManager.IMP.cancelTask()) { player.sendMessage(TranslatableCaption.of("debugexec.task_halted")); } - return MainUtil.sendMessage(player, "Cancelled task."); + player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled")); case "remove-flag": if (args.length != 2) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot debugexec remove-flag "); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", "/plot debugexec remove-flag ") + ); return false; } String flag = args[1]; @@ -280,16 +282,24 @@ public class DebugExec extends SubCommand { } } } - return MainUtil.sendMessage(player, "Cleared flag: " + flag); + player.sendMessage( + TranslatableCaption.of("debugexec.cleared_flag"), + Template.of("value", flag) + ); case "start-rgar": { if (args.length != 2) { - MainUtil.sendMessage(player, - "&cInvalid syntax: /plot debugexec start-rgar "); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", "Invalid syntax: /plot debugexec start-rgar ") + ); return false; } PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]); if (area == null) { - MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[1]); + player.sendMessage( + TranslatableCaption.of("errors.not_valid_plot_world"), + Template.of("value", args[1]) + ); return false; } boolean result; @@ -299,36 +309,33 @@ public class DebugExec extends SubCommand { result = this.hybridUtils.scheduleRoadUpdate(area, 0); } if (!result) { - MainUtil.sendMessage(player, - "&cCannot schedule mass schematic update! (Is one already in progress?)"); + player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress")); return false; } return true; } case "stop-rgar": if (!HybridUtils.UPDATE) { - MainUtil.sendMessage(player, "&cTask not running!"); + player.sendMessage(TranslatableCaption.of("debugexec.task_not_running")); return false; } HybridUtils.UPDATE = false; - MainUtil.sendMessage(player, "&cCancelling task... (Please wait)"); + player.sendMessage(TranslatableCaption.of("debugexec.cancelling_task")); return true; case "start-expire": if (ExpireManager.IMP == null) { ExpireManager.IMP = new ExpireManager(this.eventDispatcher); } if (ExpireManager.IMP.runAutomatedTask()) { - return MainUtil.sendMessage(player, "Started plot expiry task"); + player.sendMessage(TranslatableCaption.of("debugexec.expiry_started")); } else { - return MainUtil.sendMessage(player, "Plot expiry task already started"); + player.sendMessage(TranslatableCaption.of("debugexec.expiry_already_started")); } case "h": case "he": case "?": case "help": - MainUtil.sendMessage(player, - "Possible sub commands: /plot debugexec <" + StringMan - .join(allowed_params, "|") + ">"); + player.sendMessage(StaticCaption.of("Possible sub commands: /plot debugexec <" + StringMan.join(allowed_params, "|") + ">")); return false; case "addcmd": try { @@ -348,7 +355,7 @@ public class DebugExec extends SubCommand { DebugExec.this.engine.eval(cmd, DebugExec.this.scope); } catch (ScriptException e) { e.printStackTrace(); - MainUtil.sendMessage(player, Captions.COMMAND_WENT_WRONG); + player.sendMessage(TranslatableCaption.of("error.command_went_wrong")); } return CompletableFuture.completedFuture(true); } @@ -356,8 +363,10 @@ public class DebugExec extends SubCommand { return true; } catch (IOException e) { e.printStackTrace(); - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot debugexec addcmd "); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", "/plot debugexec addcmd ") + ); return false; } case "runasync": @@ -397,8 +406,10 @@ public class DebugExec extends SubCommand { break; } default: - Captions.COMMAND_SYNTAX - .send(player, "/plot debugexec list-scripts [#]"); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", "/plot debugexec list-scripts [#]") + ); return false; } @@ -415,8 +426,10 @@ public class DebugExec extends SubCommand { return true; case "allcmd": if (args.length < 3) { - Captions.COMMAND_SYNTAX - .send(player, "/plot debugexec allcmd "); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", "/plot debugexec allcmd ") + ); return false; } long start = System.currentTimeMillis(); @@ -440,7 +453,7 @@ public class DebugExec extends SubCommand { } else { player.setMeta(PlotPlayer.META_LAST_PLOT, plot); } - player.sendMessage("&c> " + (System.currentTimeMillis() - start)); + player.sendMessage(StaticCaption.of("&c> " + (System.currentTimeMillis() - start))); return true; } init(); @@ -455,8 +468,10 @@ public class DebugExec extends SubCommand { break; case "all": if (args.length < 3) { - Captions.COMMAND_SYNTAX - .send(player, "/plot debugexec all "); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", "/plot debugexec all ") + ); return false; } script = @@ -469,7 +484,7 @@ public class DebugExec extends SubCommand { script = StringMan.join(args, " "); } if (!(player instanceof ConsolePlayer)) { - MainUtil.sendMessage(player, Captions.NOT_CONSOLE); + player.sendMessage(TranslatableCaption.of("console.not_console")); return false; } init(); diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java b/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java index 7d7ef3bb7..5549a3d90 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java @@ -29,6 +29,7 @@ import com.google.common.base.Charsets; import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.world.PlotAreaManager; @@ -66,15 +67,14 @@ public class DebugImportWorlds extends Command { RunnableVal2 whenDone) throws CommandException { // UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)) if (!(this.plotAreaManager instanceof SinglePlotAreaManager)) { - player.sendMessage("Must be a single plot area!"); + player.sendMessage(TranslatableCaption.of("debugimportworlds.single_plot_area")); return CompletableFuture.completedFuture(false); } SinglePlotArea area = ((SinglePlotAreaManager) this.plotAreaManager).getArea(); PlotId id = PlotId.of(0, 0); File container = PlotSquared.platform().getWorldContainer(); if (container.equals(new File("."))) { - player.sendMessage( - "World container must be configured to be a separate directory to your base files!"); + player.sendMessage(TranslatableCaption.of("debugimportworlds.world_container")); return CompletableFuture.completedFuture(false); } for (File folder : container.listFiles()) { @@ -84,7 +84,7 @@ public class DebugImportWorlds extends Command { if (name.length() > 16) { uuid = UUID.fromString(name); } else { - Captions.FETCHING_PLAYER.send(player); + player.sendMessage(TranslatableCaption.of("players.fetching_player")); uuid = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(name, 60000L); } if (uuid == null) { @@ -100,7 +100,7 @@ public class DebugImportWorlds extends Command { } } } - player.sendMessage("Done!"); + player.sendMessage(TranslatableCaption.of("players.done")); return CompletableFuture.completedFuture(true); } } diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java index f4419371a..c83b4e804 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java @@ -31,12 +31,15 @@ import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.configuration.caption.StaticCaption; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.inject.annotations.ConfigFile; import com.plotsquared.core.inject.annotations.WorldFile; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.PremiumVerification; import com.plotsquared.core.util.net.IncendoPaster; import com.plotsquared.core.util.task.TaskManager; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import java.io.BufferedReader; @@ -54,7 +57,7 @@ import java.util.stream.Collectors; @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", - description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste", + description = "Upload settings.yml, worlds.yml, your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste", permission = "plots.debugpaste", category = CommandCategory.DEBUG, confirmation = true, @@ -147,28 +150,20 @@ public class DebugPaste extends SubCommand { incendoPaster .addFile(new IncendoPaster.PasteFile("latest.log", readFile(logFile))); } catch (IOException ignored) { - MainUtil - .sendMessage(player, "&clatest.log is too big to be pasted, will ignore"); + player.sendMessage(StaticCaption.of("&clatest.log is too big to be pasted, please reboot your server and submit a new paste.")); } try { incendoPaster.addFile(new IncendoPaster.PasteFile("settings.yml", readFile(this.configFile))); } catch (final IllegalArgumentException ignored) { - MainUtil.sendMessage(player, "&cSkipping settings.yml because it's empty"); + player.sendMessage(StaticCaption.of("&cSkipping settings.yml because it's empty.")); } try { incendoPaster.addFile(new IncendoPaster.PasteFile("worlds.yml", readFile(this.worldfile))); } catch (final IllegalArgumentException ignored) { - MainUtil.sendMessage(player, "&cSkipping worlds.yml because it's empty"); - } - try { - incendoPaster.addFile(new IncendoPaster.PasteFile("PlotSquared.use_THIS.yml", - readFile(PlotSquared.get().translationFile))); - } catch (final IllegalArgumentException ignored) { - MainUtil.sendMessage(player, - "&cSkipping PlotSquared.use_THIS.yml because it's empty"); + player.sendMessage(StaticCaption.of("&cSkipping worlds.yml because it's empty.")); } try { @@ -177,8 +172,7 @@ public class DebugPaste extends SubCommand { incendoPaster.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml", readFile(MultiverseWorlds))); } catch (final IOException ignored) { - MainUtil.sendMessage(player, - "&cSkipping Multiverse worlds.yml because the plugin is not in use"); + player.sendMessage(StaticCaption.of("&cSkipping Multiverse world's.yml because Multiverse is not in use.")); } try { @@ -191,16 +185,22 @@ public class DebugPaste extends SubCommand { final String link = String.format("https://athion.net/ISPaster/paste/view/%s", pasteId); player.sendMessage( - Captions.DEBUG_REPORT_CREATED.getTranslated().replace("%url%", link)); + TranslatableCaption.of("debugpaste.debug_report_created"), + Template.of("url", link) + ); } else { final String responseMessage = jsonObject.get("response").getAsString(); - MainUtil.sendMessage(player, String - .format("&cFailed to create the debug paste: %s", responseMessage)); + player.sendMessage( + TranslatableCaption.of("debugpaste.creation_failed"), + Template.of("value", responseMessage) + ); } } catch (final Throwable throwable) { throwable.printStackTrace(); - MainUtil.sendMessage(player, - "&cFailed to create the debug paste: " + throwable.getMessage()); + player.sendMessage( + TranslatableCaption.of("debugpaste.creation_failed"), + Template.of("value", throwable.getMessage()) + ); } } catch (IOException e) { e.printStackTrace(); diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java index f08c4d6d0..2ea80304c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java @@ -27,6 +27,7 @@ package com.plotsquared.core.command; import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.generator.HybridPlotManager; import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.location.Location; @@ -34,6 +35,7 @@ import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotManager; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import java.util.Arrays; @@ -46,7 +48,7 @@ import java.util.Arrays; permission = "plots.debugroadregen") public class DebugRoadRegen extends SubCommand { - public static final String USAGE = "/plot debugroadregen "; + public static final String USAGE = "/plot debugroadregen "; private final HybridUtils hybridUtils; @@ -56,7 +58,10 @@ public class DebugRoadRegen extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { if (args.length < 1) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", DebugRoadRegen.USAGE) + ); return false; } String kind = args[0].toLowerCase(); @@ -66,7 +71,10 @@ public class DebugRoadRegen extends SubCommand { case "region": return regenRegion(player, Arrays.copyOfRange(args, 1, args.length)); default: - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", DebugRoadRegen.USAGE) + ); return false; } } @@ -75,21 +83,26 @@ public class DebugRoadRegen extends SubCommand { Location location = player.getLocation(); PlotArea area = location.getPlotArea(); if (area == null) { - return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); + player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); } Plot plot = player.getCurrentPlot(); if (plot == null) { - Captions.NOT_IN_PLOT.send(player); + player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); } else if (plot.isMerged()) { - Captions.REQUIRES_UNMERGED.send(player); + player.sendMessage(TranslatableCaption.of("debug.requires_unmerged")); } else { PlotManager manager = area.getPlotManager(); manager.createRoadEast(plot); manager.createRoadSouth(plot); manager.createRoadSouthEast(plot); - MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.getId() - + "\n&6 - Result: &aSuccess"); - MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads"); + player.sendMessage( + TranslatableCaption.of("debugroadregen.regen_done"), + Template.of("value", String.valueOf(plot.getId())) + ); + player.sendMessage( + TranslatableCaption.of("debugroadregen.regen_all"), + Template.of("value", "/plot regenallroads") + ); } return true; } @@ -100,35 +113,40 @@ public class DebugRoadRegen extends SubCommand { try { height = Integer.parseInt(args[0]); } catch (NumberFormatException ignored) { - MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)"); - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); + player.sendMessage( + TranslatableCaption.of("invalid.not_valid_number"), + Template.of("value", "0, 256") + ); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", DebugRoadRegen.USAGE) + ); return false; } } else if (args.length != 0) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", DebugRoadRegen.USAGE) + ); return false; } Location location = player.getLocation(); PlotArea area = location.getPlotArea(); if (area == null) { - return sendMessage(player, Captions.NOT_IN_PLOT_WORLD); + player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); } Plot plot = player.getCurrentPlot(); PlotManager manager = area.getPlotManager(); if (!(manager instanceof HybridPlotManager)) { - MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD); + player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world")); return true; } - MainUtil - .sendMessage(player, "&cIf no schematic is set, the following will not do anything"); - MainUtil.sendMessage(player, - "&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic"); - MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads"); + player.sendMessage(TranslatableCaption.of("debugroadregen.schematic")); + player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads")); boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height); if (!result) { - MainUtil.sendMessage(player, - "&cCannot schedule mass schematic update! (Is one already in progress?)"); + player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress")); return false; } return true; diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugSaveTest.java b/Core/src/main/java/com/plotsquared/core/command/DebugSaveTest.java index dbaa3dade..02a2669b7 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugSaveTest.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugSaveTest.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.command; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; @@ -42,9 +43,9 @@ public class DebugSaveTest extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { final List plots = PlotQuery.newQuery().allPlots().asList(); - MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`"); + player.sendMessage(TranslatableCaption.of("debugsavetest.starting")); DBFunc.createPlotsAndData(plots, - () -> MainUtil.sendMessage(player, "&6Database sync finished!")); + () -> player.sendMessage(TranslatableCaption.of("debugsavetest.done"))); return true; } } 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 4da5de82b..0655272d6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Delete.java +++ b/Core/src/main/java/com/plotsquared/core/command/Delete.java @@ -94,7 +94,7 @@ public class Delete extends SubCommand { player.getPlotCount(location.getWorldName()); Runnable run = () -> { if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); + player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); return; } final long start = System.currentTimeMillis(); @@ -105,16 +105,21 @@ public class Delete extends SubCommand { double value = plots.size() * valueExr.evaluate((double) currentPlots); if (value > 0d) { this.econHandler.depositMoney(player, value); - sendMessage(player, Captions.ADDED_BALANCE, String.valueOf(value)); + player.sendMessage( + TranslatableCaption.of("economy.added_balance"), + Template.of("money", String.valueOf(value)) + ); } } - MainUtil.sendMessage(player, Captions.DELETING_DONE, - System.currentTimeMillis() - start); + player.sendMessage( + TranslatableCaption.of("working.deleting_done"), + Template.of("amount", String.valueOf(System.currentTimeMillis() - start)) + ); }); if (result) { plot.addRunning(); } else { - MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); + player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); } }; if (hasConfirmation(player)) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Deny.java b/Core/src/main/java/com/plotsquared/core/command/Deny.java index ebdddebcb..c86b32a79 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Deny.java +++ b/Core/src/main/java/com/plotsquared/core/command/Deny.java @@ -40,6 +40,7 @@ import com.plotsquared.core.util.PlayerManager; import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.WorldUtil; import com.sk89q.worldedit.world.gamemode.GameModes; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import java.util.Collection; @@ -50,7 +51,7 @@ import java.util.concurrent.TimeoutException; @CommandDeclaration(command = "deny", aliases = {"d", "ban"}, description = "Deny a user from entering a plot", - usage = "/plot deny ", + usage = "/plot deny ", category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Deny extends SubCommand { @@ -77,31 +78,40 @@ public class Deny extends SubCommand { return false; } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); + player.sendMessage(TranslatableCaption.of("info.plot_unowned")); return false; } if (!plot.isOwner(player.getUUID()) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY)) { - MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); + player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); return true; } PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { if (throwable instanceof TimeoutException) { - MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); + player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); } else if (throwable != null || uuids.isEmpty()) { - MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); + player.sendMessage( + TranslatableCaption.of("errors.invalid_player"), + Template.of("value", args[0]) + ); } else { for (UUID uuid : uuids) { if (uuid == DBFunc.EVERYONE && !( Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) { - MainUtil.sendMessage(player, Captions.INVALID_PLAYER, PlayerManager.getName(uuid)); + player.sendMessage( + TranslatableCaption.of("errors.invalid_player"), + Template.of("value", args[0]) + ); } else if (plot.isOwner(uuid)) { - MainUtil.sendMessage(player, Captions.CANT_REMOVE_OWNER, PlayerManager.getName(uuid)); + player.sendMessage(TranslatableCaption.of("deny.cant_remove_owner")); return; } else if (plot.getDenied().contains(uuid)) { - MainUtil.sendMessage(player, Captions.ALREADY_ADDED, PlayerManager.getName(uuid)); + player.sendMessage( + TranslatableCaption.of("member.already_added"), + Template.of("player", PlayerManager.getName(uuid)) + ); return; } else { if (uuid != DBFunc.EVERYONE) { @@ -123,7 +133,7 @@ public class Deny extends SubCommand { } } } - MainUtil.sendMessage(player, Captions.DENIED_ADDED); + player.sendMessage(TranslatableCaption.of("deny.denied_added")); } }); @@ -149,12 +159,12 @@ public class Deny extends SubCommand { } Location location = player.getLocation(); Location spawn = this.worldUtil.getSpawn(location.getWorldName()); - MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED); + player.sendMessage(TranslatableCaption.of("deny.you_got_denied")); if (plot.equals(spawn.getPlot())) { 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 - player.kick(Captions.YOU_GOT_DENIED.getTranslated()); + player.sendMessage(TranslatableCaption.of("deny.you_got_denied")); } else { player.teleport(newSpawn); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Desc.java b/Core/src/main/java/com/plotsquared/core/command/Desc.java index 3d54e2f29..1847d6871 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Desc.java +++ b/Core/src/main/java/com/plotsquared/core/command/Desc.java @@ -64,7 +64,7 @@ public class Desc extends SetCommand { return false; } plot.removeFlag(event.getFlag()); - MainUtil.sendMessage(player, Captions.DESC_UNSET); + player.sendMessage(TranslatableCaption.of("desc.desc_unset")); return true; } PlotFlagAddEvent event = this.eventDispatcher.callFlagAdd(plot.getFlagContainer().getFlag(DescriptionFlag.class).createFlagInstance(desc), plot); @@ -76,10 +76,10 @@ public class Desc extends SetCommand { } boolean result = plot.setFlag(event.getFlag()); if (!result) { - MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); + player.sendMessage(TranslatableCaption.of("flag.flag_not_added")); return false; } - MainUtil.sendMessage(player, Captions.DESC_SET); + player.sendMessage(TranslatableCaption.of("desc.desc_set")); return true; } } diff --git a/Core/src/main/java/com/plotsquared/core/command/Done.java b/Core/src/main/java/com/plotsquared/core/command/Done.java index 93818d965..e95e3dfff 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Done.java +++ b/Core/src/main/java/com/plotsquared/core/command/Done.java @@ -81,19 +81,19 @@ public class Done extends SubCommand { boolean force = event.getEventResult() == Result.FORCE; if (!force && !plot.isOwner(player.getUUID()) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DONE)) { - MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); + player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); return false; } if (DoneFlag.isDone(plot)) { - MainUtil.sendMessage(player, Captions.DONE_ALREADY_DONE); + player.sendMessage(TranslatableCaption.of("done.done_already_done")); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); + player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); return false; } plot.addRunning(); - MainUtil.sendMessage(player, Captions.GENERATING_LINK); + player.sendMessage(TranslatableCaption.of("web.generating_lin")); final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done"); if (ExpireManager.IMP == null || doneRequirements == null) { finish(plot, player, true); @@ -111,9 +111,9 @@ public class Done extends SubCommand { return true; } - private void finish(Plot plot, PlotPlayer pp, boolean success) { + private void finish(Plot plot, PlotPlayer player, boolean success) { if (!success) { - MainUtil.sendMessage(pp, Captions.DONE_INSUFFICIENT_COMPLEXITY); + player.sendMessage(TranslatableCaption.of("done.done_insufficient_complexity")); return; } long flagValue = System.currentTimeMillis() / 1000; @@ -121,10 +121,10 @@ public class Done extends SubCommand { .createFlagInstance(Long.toString(flagValue)); PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); if (event.getEventResult() == Result.DENY) { - sendMessage(pp, Captions.EVENT_DENIED, "Done flag addition"); + player.sendMessage(TranslatableCaption.of("events.event_denied")); return; } plot.setFlag(plotFlag); - MainUtil.sendMessage(pp, Captions.DONE_SUCCESS); + player.sendMessage(TranslatableCaption.of("done.done_success")); } } 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 7b869efac..bde2689ea 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Download.java +++ b/Core/src/main/java/com/plotsquared/core/command/Download.java @@ -28,6 +28,7 @@ package com.plotsquared.core.command; import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Settings; +import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; @@ -39,6 +40,7 @@ import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.RunnableVal; import com.sk89q.jnbt.CompoundTag; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import java.net.URL; @@ -75,27 +77,27 @@ public class Download extends SubCommand { return false; } if (!plot.hasOwner()) { - MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); + player.sendMessage(TranslatableCaption.of("info.plot_unowned")); return false; } if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot))) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) { - MainUtil.sendMessage(player, Captions.DONE_NOT_DONE); + player.sendMessage(TranslatableCaption.of("done.done_not_done")); return false; } if ((!plot.isOwner(player.getUUID())) && !Permissions .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { - MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); + player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); return false; } if (plot.getRunning() > 0) { - MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); + player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); return false; } if (args.length == 0 || (args.length == 1 && StringMan .isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) { if (plot.getVolume() > Integer.MAX_VALUE) { - Captions.SCHEMATIC_TOO_LARGE.send(player); + player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); return false; } plot.addRunning(); @@ -105,10 +107,11 @@ public class Download extends SubCommand { schematicHandler.upload(value, null, null, new RunnableVal() { @Override public void run(URL url) { if (url == null) { - MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED); + player.sendMessage(TranslatableCaption.of("web.generating_link_failed")); return; } - MainUtil.sendMessage(player, url.toString()); + player.sendMessage(StaticCaption.of(url.toString()) + ); } }); } @@ -116,27 +119,30 @@ public class Download extends SubCommand { } else if (args.length == 1 && StringMan .isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) { if (!Permissions.hasPermission(player, Captions.PERMISSION_DOWNLOAD_WORLD)) { - Captions.NO_PERMISSION.send(player, Captions.PERMISSION_DOWNLOAD_WORLD); + player.sendMessage( + TranslatableCaption.of("permission.no_permission"), + Template.of("node", Captions.PERMISSION_DOWNLOAD_WORLD.getTranslated()) + ); return false; } - MainUtil.sendMessage(player, Captions.MCA_FILE_SIZE); + player.sendMessage(TranslatableCaption.of("schematics.mca_file_size")); plot.addRunning(); this.worldUtil.saveWorld(world); this.worldUtil.upload(plot, null, null, new RunnableVal() { @Override public void run(URL url) { plot.removeRunning(); if (url == null) { - MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED); + player.sendMessage(TranslatableCaption.of("web.generating_link_failed")); return; } - MainUtil.sendMessage(player, url.toString()); + player.sendMessage(StaticCaption.of(url.toString()) } }); } else { sendUsage(player); return false; } - MainUtil.sendMessage(player, Captions.GENERATING_LINK); + player.sendMessage(TranslatableCaption.of("web.generating_link")); return true; } } 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 973eccf9d..04abe3d07 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Grant.java +++ b/Core/src/main/java/com/plotsquared/core/command/Grant.java @@ -29,6 +29,7 @@ import com.google.common.primitives.Ints; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.caption.CaptionUtility; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.Permissions; @@ -36,6 +37,7 @@ import com.plotsquared.core.util.PlayerManager; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; +import net.kyori.adventure.text.minimessage.Template; import java.util.Map; import java.util.UUID; @@ -74,9 +76,12 @@ public class Grant extends Command { } PlayerManager.getUUIDsFromString(args[1], (uuids, throwable) -> { if (throwable instanceof TimeoutException) { - MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); + player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); } else if (throwable != null || uuids.size() != 1) { - MainUtil.sendMessage(player, Captions.INVALID_PLAYER); + player.sendMessage( + TranslatableCaption.of("errors.invalid_player"), + Template.of("value", String.valueOf(uuids)) + ); } else { final UUID uuid = uuids.toArray(new UUID[0])[0]; final Consumer result = array -> { @@ -87,7 +92,10 @@ public class Grant extends Command { } else { granted = Ints.fromByteArray(array); } - Captions.GRANTED_PLOTS.send(player, granted); + player.sendMessage( + TranslatableCaption.of("grants.granted_plots"), + Template.of("amount", String.valueOf(granted)) + ); } else { // add int amount; if (array == null) { 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 2cc88010e..2898ddea0 100644 --- a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java @@ -27,6 +27,7 @@ package com.plotsquared.core.command; import com.google.inject.Inject; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; @@ -40,6 +41,7 @@ import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.SortingStrategy; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -69,11 +71,14 @@ public class HomeCommand extends Command { final RunnableVal2 whenDone) { List plots = query.asList(); if (plots.isEmpty()) { - Captions.FOUND_NO_PLOTS.send(player); + player.sendMessage(TranslatableCaption.of("invalid.found_no_plots")); return; } else if (plots.size() < page) { - MainUtil.sendMessage(player, - String.format(Captions.NUMBER_NOT_IN_RANGE.getTranslated(), "1", plots.size())); + player.sendMessage( + TranslatableCaption.of("invalid.number_not_in_range"), + Template.of("min", "1"), + Template.of("max", String.valueOf(plots.size())) + ); return; } Plot plot = plots.get(page - 1); @@ -101,7 +106,10 @@ public class HomeCommand extends Command { // /plot home if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OWNED) && !Permissions .hasPermission(player, Captions.PERMISSION_HOME)) { - Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OWNED); + player.sendMessage( + TranslatableCaption.of("permission.no_permission"), + Template.of("node", Captions.PERMISSION_VISIT_OWNED.getTranslated()) + ); return CompletableFuture.completedFuture(false); } if (args.length > 2) { @@ -119,7 +127,10 @@ public class HomeCommand extends Command { try { page = Integer.parseInt(identifier); } catch (NumberFormatException ignored) { - Captions.NOT_A_NUMBER.send(player, identifier); + player.sendMessage( + TranslatableCaption.of("invalid.not_a_number"), + Template.of("value", identifier) + ); return CompletableFuture.completedFuture(false); } query.withSortingStrategy(SortingStrategy.SORT_BY_CREATION); @@ -151,7 +162,10 @@ public class HomeCommand extends Command { try { page = Integer.parseInt(identifier); } catch (NumberFormatException ignored) { - Captions.NOT_A_NUMBER.send(player, identifier); + player.sendMessage( + TranslatableCaption.of("invalid.not_a_number"), + Template.of("value", identifier) + ); return CompletableFuture.completedFuture(false); } query.withSortingStrategy(SortingStrategy.SORT_BY_CREATION); diff --git a/Core/src/main/java/com/plotsquared/core/command/Inbox.java b/Core/src/main/java/com/plotsquared/core/command/Inbox.java index 8d2663377..9ec22f008 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Inbox.java +++ b/Core/src/main/java/com/plotsquared/core/command/Inbox.java @@ -26,6 +26,7 @@ package com.plotsquared.core.command; import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; @@ -34,6 +35,7 @@ import com.plotsquared.core.plot.comment.CommentManager; import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.RunnableVal; +import net.kyori.adventure.text.minimessage.Template; import java.util.List; @@ -47,7 +49,7 @@ public class Inbox extends SubCommand { public void displayComments(PlotPlayer player, List oldComments, int page) { if (oldComments == null || oldComments.isEmpty()) { - MainUtil.sendMessage(player, Captions.INBOX_EMPTY); + player.sendMessage(TranslatableCaption.of("comment.inbox_empty")); return; } PlotComment[] comments = oldComments.toArray(new PlotComment[0]); @@ -83,7 +85,7 @@ public class Inbox extends SubCommand { .append(comment.id).append("&8][&6").append(comment.senderName).append("&8]") .append(color).append(comment.comment).append('\n'); } - MainUtil.sendMessage(player, string.toString()); + player.sendMessage(StaticCaption.of(string.toString())); } @Override public boolean onCommand(final PlotPlayer player, String[] args) { @@ -93,7 +95,7 @@ public class Inbox extends SubCommand { return false; } if (!plot.hasOwner()) { - sendMessage(player, Captions.PLOT_UNOWNED); + player.sendMessage(TranslatableCaption.of("info.plot_unowned")); return false; } if (args.length == 0) { @@ -125,10 +127,16 @@ public class Inbox extends SubCommand { return; } } - sendMessage(player, Captions.INBOX_ITEM, inbox.toString()); + player.sendMessage( + TranslatableCaption.of("comment.inbox_item"), + Template.of("value", inbox.toString()) + ); } })) { - sendMessage(player, Captions.INBOX_ITEM, inbox.toString()); + player.sendMessage( + TranslatableCaption.of("comment.inbox_item"), + Template.of("value", inbox.toString()) + ); } } } @@ -146,41 +154,54 @@ public class Inbox extends SubCommand { switch (args[1].toLowerCase()) { case "delete": if (!inbox.canModify(plot, player)) { - sendMessage(player, Captions.NO_PERM_INBOX_MODIFY); + player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify")); return false; } if (args.length != 3) { - sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot inbox " + inbox.toString() + " delete "); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", "/plot inbox " + inbox.toString() + " delete ") + ); } final int index; try { index = Integer.parseInt(args[2]); if (index < 1) { - sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + ""); + player.sendMessage( + TranslatableCaption.of("comment.not_valid_inbox_index"), + Template.of("number", index + "") + ); return false; } } catch (NumberFormatException ignored) { - sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot inbox " + inbox.toString() + " delete "); + player.sendMessage( + TranslatableCaption.of("commandconfig.command_syntax"), + Template.of("value", "/plot inbox " + inbox.toString() + " delete ") + ); return false; } if (!inbox.getComments(plot, new RunnableVal>() { @Override public void run(List value) { if (index > value.size()) { - sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + ""); + player.sendMessage( + TranslatableCaption.of("comment.not_valid_inbox_index"), + Template.of("number", index + "") + ); return; } PlotComment comment = value.get(index - 1); inbox.removeComment(plot, comment); boolean success = plot.removeComment(comment); if (success) { - MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, - comment.comment); + player.sendMessage( + TranslatableCaption.of("comment.comment_removed_success"), + Template.of("value", comment.comment) + ); } else { - MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_FAILURE, - comment.comment); + player.sendMessage( + TranslatableCaption.of("comment.comment_removed_failure")); + } } @@ -191,14 +212,17 @@ public class Inbox extends SubCommand { return true; case "clear": if (!inbox.canModify(plot, player)) { - sendMessage(player, Captions.NO_PERM_INBOX_MODIFY); + player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify")); } inbox.clearInbox(plot); List comments = plot.getComments(inbox.toString()); if (!comments.isEmpty()) { plot.removeComments(comments); } - MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, "*"); + player.sendMessage( + TranslatableCaption.of("comment.comment_removed_success"), + Template.of("value", "*") + ); return true; default: try { @@ -212,7 +236,7 @@ public class Inbox extends SubCommand { page = 1; } if (!inbox.canRead(plot, player)) { - sendMessage(player, Captions.NO_PERM_INBOX); + player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox")); return false; } if (!inbox.getComments(plot, new RunnableVal>() { @@ -220,7 +244,7 @@ public class Inbox extends SubCommand { displayComments(player, value, page); } })) { - sendMessage(player, Captions.PLOT_UNOWNED); + player.sendMessage(TranslatableCaption.of("info.plot_unowned")); return false; } return true; diff --git a/Core/src/main/java/com/plotsquared/core/command/Info.java b/Core/src/main/java/com/plotsquared/core/command/Info.java index c0a771b0b..b8f80b934 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Info.java +++ b/Core/src/main/java/com/plotsquared/core/command/Info.java @@ -27,10 +27,12 @@ package com.plotsquared.core.command; 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.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.implementations.HideInfoFlag; +import net.kyori.adventure.text.minimessage.Template; @CommandDeclaration(command = "info", aliases = "i", @@ -77,7 +79,7 @@ public class Info extends SubCommand { plot = player.getCurrentPlot(); } if (plot == null) { - MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.getTranslated()); + player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); return false; } @@ -96,7 +98,10 @@ public class Info extends SubCommand { if (argument.equalsIgnoreCase("-f")) { if (!player .hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())) { - Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_INFO_FORCE); + player.sendMessage( + TranslatableCaption.of("permission.no_permission"), + Template.of("node", Captions.PERMISSION_AREA_INFO_FORCE.getTranslated()) + ); return true; } allowed = true; @@ -104,7 +109,7 @@ public class Info extends SubCommand { } } if (!allowed) { - Captions.PLOT_INFO_HIDDEN.send(player); + player.sendMessage(TranslatableCaption.of("info.plot_info_hidden")); return true; } } @@ -115,8 +120,10 @@ public class Info extends SubCommand { boolean trustedEveryone = plot.getMembers().contains(DBFunc.EVERYONE); // Unclaimed? if (!hasOwner && !containsEveryone && !trustedEveryone) { - MainUtil.sendMessage(player, Captions.PLOT_INFO_UNCLAIMED, - plot.getId().getX() + ";" + plot.getId().getY()); + player.sendMessage( + TranslatableCaption.of("info.plot_info_unclaimed"), + Template.of("plot", plot.getId().getX() + ";" + plot.getId().getY()) + ); return true; } String info = Captions.PLOT_INFO_FORMAT.getTranslated(); diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 1703d203c..2a6ca09fc 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -77,7 +77,7 @@ "comment.no_perm_inbox": "You do not have permission for that inbox.", "comment.no_perm_inbox_modify": "You do not have permission to modify that inbox.", "comment.no_plot_inbox": "You must stand in or supply a plot argument", - "comment.comment_removed_success": "Successfully deleted comment/s:n - ", + "comment.comment_removed_success": "Successfully deleted comment(s)\n - ", "comment.comment_removed_failure": "Failed to delete comment!", "comment.comment_added": "A comment has been left.", "comment.inbox_empty": "No comments.", @@ -160,7 +160,6 @@ "schematics.schematic_paste_failed": "Failed to paste the schematic.", "schematics.schematic_paste_success": "The schematic pasted successfully.", "schematics.schematic_list": "Saved Schematics: ", - "schematics.schematic_road_created": "Saved new road schematic. To test the schematic, fly to a few other plots and run /plot debugroadregen.", "schematics.mca_file_size": "Note: The `.mca` files are 512x512.", "schematics.schematic_exportall_started": "Starting export...", "schematics.schematic_exportall_world_args": "Need world argument. Use /plot sch exportall area", @@ -267,10 +266,25 @@ "debugexec.threshold_default_double": "$1 $2= $1The percentage of plots you want to clear as a number between 0 - 100.", "debugexec.calibration_done": "Thank you for calibrating plot expiry.", "debugexec.task_halted": "Task already halted.", + "debugexec.cancelling_task": "Task cancelled.", + "debugexec.task_cancelled": "Task cancelled.", + "debugexec.cleared_flag": "Cleared flag: ", + "debugexec.mass_schematic_update_in_progress": "Cannot schedule mass schematic update. (Is one already in progress?)", + "debugexec.task_not_running": "Task not running.", + "debugexec.expiry_started": "Started plot expiry task.", + "debugexec.expiry_already_started": "Plot expiry task already started.", + "debugimportworlds.single_plot_area": "Must be a single plot area.", + "debugimportworlds.world_container": "World container must be configured to be a separate directory to your base files.", + "debugimportworlds.done": "Done!", + + "debugroadregen.regen_done": "Regenerating plot south/east roads: \n - Result: Success!To regen all roads: ", + "schematics.schematic_road_created": "Saved new road schematic. To test the schematic, fly to a few other plots and run /plot debugroadregen.", + "debugroadregen.schematic": "If no schematic is set, the following will not do anything.\n - To set a schematic, stand in a plot and use /plot createroadschematic", + "debugroadregen.regenallroads": "To regenerate all roads: /plot regenallroads", "errors.invalid_player": "Player not found: .", - "errors.invalid_player_offline": "The player must be online: .", "errors.invalid_command_flag": "Invalid command flag: ", "errors.error": "An error occurred: ", @@ -289,8 +303,13 @@ "errors.wait_for_timer": "A set block timer is bound to either the current plot or you. Please wait for it to finish.", "errors.tile_entity_cap_reached": "The total number of tile entities in this chunk may not exceed .", "error.plot_size": "Error: size <= 0.", + "error.command_went_wrong": "Something went wrong when executing that command...", "debugpaste.debug_report_created": "Uploaded a full debug to: ", + "debugpaste.creation_failed": "Failed to create the debugpaste: ", + + "debugsavetest.starting": "Starting debugsavetest.", + "debugsavetest.done": "Database sync finished..", "purge.purge_success": "Successfully purged plots.", @@ -326,7 +345,7 @@ "info.plot_unowned": "The current plot must have an owner to perform this action.", "info.plot_info_unclaimed": "Plot is not yet claimed.", "info.plot_info_header": "--------- INFO ---------", - "info.plot_info_hidden": "You cannot view the information about this plot.", + "info.plot_info_hidden": "You cannot view the information about this plot.", "info.plot_info_format": "ID: \nArea: \nAlias:\nOwner:\nBiome: \nCan Build: \nRating: \nSeen: \nTrusted:\nMembers:\nDenied:\nFlags:\nDescription: ", "info.plot_info_footer": "--------- INFO ---------", "info.plot_info_trusted": "Trusted:", @@ -607,11 +626,27 @@ "commands.description.comment": "Comment on a plot.", "commands.description.condense": "Condense a plotworld.", "commands.description.confirm": "Confirm an action.", - "commands.description.done": "Continue a plot that was previously marked as done.", "commands.description.copy": "Copy a plot.", "commands.description.createroadschematic": "Add a road schematic to your world using the roads around your current plot.", "commands.description.database": "Convert/Backup Storage.", "commands.description.debug": "Show debug information.", "commands.description.debugallowunsafe": "Allow unsafe actions until toggled off.", - "commands.description.debugexec": "Multi-purpose debug command." + "commands.description.debugexec": "Multi-purpose debug command.", + "commands.description.debugimportworlds": "Import worlds by player name.", + "commands.description.debugloadtest": "This debug command will force the reload of all plots in the database.", + "commands.description.debugpaste": "Upload settings.yml, worlds.yml, your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste", + "commands.description.debugroadregen": "Regenerate roads in the plot or region the user is, based on the road schematic.", + "commands.description.debugsavetest": "This command will force the recreation of all plots in the database.", + "commands.description.delete": "Delete the plot you stand on.", + "commands.description.deny": "Deny a user from entering a plot.", + "commands.description.desc": "Set the plot description.", + "commands.description.dislike": "Dislike the plot.", + "commands.description.done": "Continue a plot that was previously marked as done.", + "commands.description.download": "Download your plot.", + "commands.description.flags": "Manage plot flags.", + "commands.description.grant": "Manage plot grants.", + "commands.description.help": "Get this help menu.", + "commands.description.home": "Teleport to your plot(s).", + "commands.description.inbox": "Review the comments for a plot.", + "commands.description.info": "Display information about the plot." }