From c9fae6a0705c8491bfb8c09c2ce030d4cc8a3304 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Thu, 13 Aug 2020 21:11:07 +0200 Subject: [PATCH] Remove old translation setup and move commands to templates --- .../com/plotsquared/core/PlotSquared.java | 9 ------- .../com/plotsquared/core/command/Area.java | 6 +++-- .../plotsquared/core/command/CmdConfirm.java | 3 ++- .../com/plotsquared/core/command/Comment.java | 4 +++ .../core/command/CreateRoadSchematic.java | 4 ++- .../core/command/DebugRoadRegen.java | 6 +++-- .../com/plotsquared/core/command/Load.java | 10 +++++-- .../core/command/RegenAllRoads.java | 5 ++-- .../core/configuration/Settings.java | 1 - .../core/listener/WESubscriber.java | 4 ++- .../core/plot/comment/CommentManager.java | 3 ++- Core/src/main/resources/lang/messages_en.json | 26 ++++++++----------- 12 files changed, 43 insertions(+), 38 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 0e4ef5cb4..83ae671a1 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -218,14 +218,6 @@ public class PlotSquared { copyFile("town.template", Settings.Paths.TEMPLATES); copyFile("bridge.template", Settings.Paths.TEMPLATES); copyFile("skyblock.template", Settings.Paths.TEMPLATES); - copyFile("de-DE.yml", Settings.Paths.TRANSLATIONS); - copyFile("es-ES.yml", Settings.Paths.TRANSLATIONS); - copyFile("zh-CN.yml", Settings.Paths.TRANSLATIONS); - copyFile("it-IT.yml", Settings.Paths.TRANSLATIONS); - copyFile("ko-KR.yml", Settings.Paths.TRANSLATIONS); - copyFile("hu-HU.yml", Settings.Paths.TRANSLATIONS); - copyFile("pt-BR.yml", Settings.Paths.TRANSLATIONS); - copyFile("fr-FR.yml", Settings.Paths.TRANSLATIONS); showDebug(); } catch (Throwable e) { e.printStackTrace(); @@ -1314,7 +1306,6 @@ public class PlotSquared { * Setup all configuration files
* - Config: settings.yml
* - Storage: storage.yml
- * - Translation: PlotSquared.use_THIS.yml, style.yml
*/ public boolean setupConfigs() { File folder = new File(this.platform.getDirectory(), "config"); diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index e918f8daa..283006d07 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -143,7 +143,8 @@ public class Area extends SubCommand { return false; } if (args.length < 2) { - player.sendMessage(TranslatableCaption.of("single.single_area_needs_name")); + player.sendMessage(TranslatableCaption.of("single.single_area_needs_name"), + Template.of("command", "/plot area single ")); return false; } final PlotArea existingArea = @@ -305,7 +306,8 @@ public class Area extends SubCommand { player.sendMessage(TranslatableCaption.of("set.set_attribute"), Template.of("attribute", "area_pos1"), Template.of("value", location.getX() + "," + location.getZ())); - player.sendMessage(TranslatableCaption.of("area.set_pos2")); + player.sendMessage(TranslatableCaption.of("area.set_pos2"), + Template.of("command", "/plot area create pos2")); return true; } case "pos2": // Set position 2 and finish creation for type=2 (partial) diff --git a/Core/src/main/java/com/plotsquared/core/command/CmdConfirm.java b/Core/src/main/java/com/plotsquared/core/command/CmdConfirm.java index b809b63d7..e0b9bbbb3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/CmdConfirm.java +++ b/Core/src/main/java/com/plotsquared/core/command/CmdConfirm.java @@ -57,7 +57,8 @@ public class CmdConfirm { if (commandStr != null) { player.sendMessage( TranslatableCaption.of("confirm.requires_confirm"), - Template.of("command", commandStr) + Template.of("command", commandStr), + Template.of("value", "/plot confirm") ); } TaskManager.runTaskLater(() -> { diff --git a/Core/src/main/java/com/plotsquared/core/command/Comment.java b/Core/src/main/java/com/plotsquared/core/command/Comment.java index 457483d7c..fe472a543 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Comment.java +++ b/Core/src/main/java/com/plotsquared/core/command/Comment.java @@ -51,6 +51,7 @@ public class Comment extends SubCommand { if (args.length < 2) { player.sendMessage( TranslatableCaption.of("comment.comment_syntax"), + Template.of("command", "/plot comment [X;Z]"), Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|")) ); return false; @@ -70,6 +71,7 @@ public class Comment extends SubCommand { if (args.length < 3) { player.sendMessage( TranslatableCaption.of("comment.comment_syntax"), + Template.of("command", "/plot comment [X;Z]"), Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|")) ); return false; @@ -81,6 +83,7 @@ public class Comment extends SubCommand { if (inbox == null) { player.sendMessage( TranslatableCaption.of("comment.comment_syntax"), + Template.of("command", "/plot comment [X;Z]"), Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|")) ); return false; @@ -100,6 +103,7 @@ public class Comment extends SubCommand { player.sendMessage(TranslatableCaption.of("comment.no_plot_inbox")); player.sendMessage( TranslatableCaption.of("comment.comment_syntax"), + Template.of("command", "/plot comment [X;Z]"), Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|")) ); return false; diff --git a/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java b/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java index c78ccf630..ebdab6c65 100644 --- a/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java +++ b/Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java @@ -32,6 +32,7 @@ import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.location.Location; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; @@ -61,7 +62,8 @@ public class CreateRoadSchematic extends SubCommand { player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); } this.hybridUtils.setupRoadSchematic(plot); - player.sendMessage(TranslatableCaption.of("schematics.schematic_road_created")); + player.sendMessage(TranslatableCaption.of("schematics.schematic_road_created"), + Template.of("command", "/plot debugroadregen")); return true; } } 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 10e8b3f3e..08afc831a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java @@ -143,8 +143,10 @@ public class DebugRoadRegen extends SubCommand { player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world")); return true; } - player.sendMessage(TranslatableCaption.of("debugroadregen.schematic")); - player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads")); + player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"), + Template.of("command", "/plot createroadschematic")); + player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads"), + Template.of("command", "/plot regenallroads")); boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height); if (!result) { player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress")); diff --git a/Core/src/main/java/com/plotsquared/core/command/Load.java b/Core/src/main/java/com/plotsquared/core/command/Load.java index aeba0a873..3e8ab1b41 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Load.java +++ b/Core/src/main/java/com/plotsquared/core/command/Load.java @@ -100,7 +100,10 @@ public class Load extends SubCommand { List schematics = metaDataAccess.get().orElse(null); if (schematics == null) { // No schematics found: - player.sendMessage(TranslatableCaption.of("web.load_null")); + player.sendMessage( + TranslatableCaption.of("web.load_null"), + Template.of("command", "/plot load") + ); return false; } String schematic; @@ -201,7 +204,10 @@ public class Load extends SubCommand { e.printStackTrace(); } } - player.sendMessage(TranslatableCaption.of("web.load_list")); + player.sendMessage( + TranslatableCaption.of("web.load_list"), + Template.of("command", "/plot load #") + ); } } diff --git a/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java b/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java index 7a42442f4..478fb29d3 100644 --- a/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java +++ b/Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java @@ -93,9 +93,8 @@ public class RegenAllRoads extends SubCommand { return false; } //Set chunks = ChunkManager.manager.getChunkChunks(name); - player.sendMessage(TranslatableCaption.of("debugroadregen.schematic")); - //MainUtil.sendMessage(player, "&6Potential chunks to update: &7" + (chunks.size() * 1024)); - //MainUtil.sendMessage(player, "&6Estimated time: &7" + chunks.size() + " seconds"); + player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"), + Template.of("command", "/plot createroadschematic")); boolean result = this.hybridUtils.scheduleRoadUpdate(area, height); if (!result) { player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress")); diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 3aa084655..aeca45577 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -409,7 +409,6 @@ public class Settings extends Config { public static String SCHEMATICS = "schematics"; public static String SCRIPTS = "scripts"; public static String TEMPLATES = "templates"; - public static String TRANSLATIONS = "translations"; } diff --git a/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java b/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java index 7f95ef64e..c0d16753b 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java +++ b/Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java @@ -45,6 +45,7 @@ import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.EventHandler.Priority; import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.world.World; +import net.kyori.adventure.text.minimessage.Template; import javax.annotation.Nonnull; import java.util.Set; @@ -91,7 +92,8 @@ public class WESubscriber { mask = WEManager.getMask(plotPlayer); if (mask.isEmpty()) { if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) { - plotPlayer.sendMessage(TranslatableCaption.of("worldedit.worldedit_bypass")); + plotPlayer.sendMessage(TranslatableCaption.of("worldedit.worldedit_bypass"), + Template.of("command", "/plot wea")); } if (this.plotAreaManager.hasPlotArea(world)) { event.setExtent(new NullExtent()); diff --git a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java index 76f5009aa..ffda6422c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java @@ -75,7 +75,8 @@ import java.util.concurrent.atomic.AtomicInteger; player.sendTitle( StaticCaption.of(""), TranslatableCaption.of("comment.inbox_notification"), - Template.of("amount", Integer.toString(total)) + Template.of("amount", Integer.toString(total)), + Template.of("command", "/plot inbox") ); } } diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index b944d20e0..fd9301af0 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -1,7 +1,7 @@ { "confirm.expired_confirm": "Confirmation has expired, please run the command again!", "confirm.failed_confirm": "You have no pending actions to confirm!", - "confirm.requires_confirm": "Are you sure you wish to execute: ?\nThis cannot be undone! If you are sure: /plot confirm", + "confirm.requires_confirm": "Are you sure you wish to execute: ?\nThis cannot be undone! If you are sure: ", "move.move_success": "Successfully moved plot.", "move.move_merged": "Merged plots may not be moved. Please unmerge the plot before performing the move.", @@ -21,14 +21,14 @@ "set.set_attribute": "Successfully set to .", - "area.set_pos2": "You will now set pos2: /plot area create pos2. Note: The chosen plot size may result in the created area not exactly matching your second position.", + "area.set_pos2": "You will now set pos2: . Note: The chosen plot size may result in the created area not exactly matching your second position.", "web.generating_link": "Processing plot...", "web.generating_link_failed": "Failed to generate download link!", "web.save_failed": "Failed to save.", - "web.load_null": "Please use /plot load to get a list of schematics.", + "web.load_null": "Please use to get a list of schematics.", "web.load_failed": "Failed to load schematic.", - "web.load_list": "To load a schematic, use /plot load #.", + "web.load_list": "To load a schematic, use .", "web.save_success": "Successfully saved!", "compass.compass_target": "Successfully targeted plot with your compass.", @@ -60,7 +60,7 @@ "border.border": "You are outside the current map border.", - "worldedit.worldedit_bypass": "To bypass your restrictions use /plot wea", + "worldedit.worldedit_bypass": "To bypass your restrictions use ", "worldedit.worldedit_bypassed": "Currently bypassing WorldEdit restriction.", "gamemode.gamemode_was_bypassed": "You bypassed the gamemode () set for .", @@ -74,10 +74,10 @@ "swap.swap_success": "Successfully swapped plots.", "swap.swap_merged": "Merged plots may not be swapped. Please unmerge the plots before performing the swap.", - "comment.inbox_notification": " unread messages. Use /plot inbox.", + "comment.inbox_notification": " unread messages. Use .", "comment.not_valid_inbox_index": "No comment at index .", "comment.inbox_item": " - ", - "comment.comment_syntax": "Use /plot comment [X;Z] <> ", + "comment.comment_syntax": "Use <> ", "comment.invalid_inbox": "That is not a valid inbox.\nAccepted values: ", "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.", @@ -129,7 +129,6 @@ "setup.setup_not_started": "No setup started.", "setup.setup_init": "Usage: /plot setup ", "setup.setup_step": "[Step ] - Expecting: Default: ", - "setup.setup_invalid_arg": " is not a valid argument for step . To cancel setup use: /plot setup cancel.", "setup.setup_valid_arg": "Value set to .", "setup.setup_finished": "You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or your chosen world management plugin.", "setup.setup_world_taken": " is already a world. Choose a different name.", @@ -292,9 +291,9 @@ "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", + "schematics.schematic_road_created": "Saved new road schematic. To test the schematic, fly to a few other plots and run .", + "debugroadregen.schematic": "If no schematic is set, the following will not do anything.\n - To set a schematic, stand in a plot and use ", + "debugroadregen.regenallroads": "To regenerate all roads: ", "errors.invalid_player": "Player not found: .", "errors.invalid_player_offline": " must be online.", @@ -462,13 +461,11 @@ "events.event_denied": " Cancelled by external plugin.", - "backups.backup_usage": "Usage: /plot backup save/list/load", "backups.backup_impossible": "Backups are not enabled for this plot: .", "backups.backup_save_success": "The backup was created successfully.", "backups.backup_save_failed": "The backup could not be created: ", "backups.backup_load_success": "The backup was restored successfully.", "backups.backup_load_failure": "The backup could not be restored: ", - "backups.backup_load_usage": "Usage: /plot backup load [#]", "backups.backup_list_header": "Available backups for plot ", "backups.backup_list_entry": "- # ", "backups.backup_list_failed": "Backup listing failed: ", @@ -489,7 +486,7 @@ "single.single_area_missing_selection": "Error! You need to select a square region.", "single.single_area_not_square": "Error! Your selection needs to be a square.", "single.single_area_overlapping": "Error! Your selection overlaps with an existing plot area.", - "single.single_area_needs_name": "Error! Please specify a plot name: /plot area single ", + "single.single_area_needs_name": "Error! Please specify a plot name: ", "single.single_area_name_taken": "Error! The plot name is already taken.", "single.single_area_failed_to_save": "Error! Failed to save the area schematic.", "single.single_area_could_not_make_directories": "Error! Failed to create the schematic directory.", @@ -632,7 +629,6 @@ "flags.flag_error_gamemode": "Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator.", "flags.flag_error_integer": "Flag value must be a whole number.", "flags.flag_error_integer_list": "Flag value must be an integer list.", - "flags.flag_error_internal": "Value(s) must be numeric. /plot set flag [amount].", "flags.flag_error_keep": "Flag value must be a timestamp or a boolean.", "flags.flag_error_long": "Flag value must be a whole number (large numbers allowed).", "flags.flag_error_plotblocklist": "Flag value must be a block list.",