From 491a171409f48a314ba6ea0ddd311604610c49d4 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 6 May 2021 10:30:04 +0200 Subject: [PATCH] Fix invalid backup messages & component prefix & update minimessage --- .../com/plotsquared/core/command/Backup.java | 23 ++++++++++--------- .../components/ComponentPresetManager.java | 3 ++- Core/src/main/resources/lang/messages_en.json | 10 ++++---- gradle/libs.versions.toml | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Backup.java b/Core/src/main/java/com/plotsquared/core/command/Backup.java index da0fa5a4e..5876c9af0 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Backup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Backup.java @@ -142,14 +142,14 @@ public final class Backup extends Command { } else if (!plot.hasOwner()) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_unowned") + Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) ); } else if (plot.getVolume() > Integer.MAX_VALUE) { player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); } else if (plot.isMerged()) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_merged") + Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) ); } else if (!plot.isOwner(player.getUUID()) && !Permissions .hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) { @@ -162,7 +162,7 @@ public final class Backup extends Command { if (backupProfile instanceof NullBackupProfile) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_other") + Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) ); } else { backupProfile.createBackup().whenComplete((backup, throwable) -> { @@ -196,12 +196,12 @@ public final class Backup extends Command { } else if (!plot.hasOwner()) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_unowned") + Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) ); } else if (plot.isMerged()) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_merged") + Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) ); } else if (plot.getVolume() > Integer.MAX_VALUE) { player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); @@ -216,7 +216,7 @@ public final class Backup extends Command { if (backupProfile instanceof NullBackupProfile) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_other") + Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) ); } else { backupProfile.listBackups().whenComplete((backups, throwable) -> { @@ -267,12 +267,12 @@ public final class Backup extends Command { } else if (!plot.hasOwner()) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_unowned") + Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) ); } else if (plot.isMerged()) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_merged") + Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) ); } else if (plot.getVolume() > Integer.MAX_VALUE) { player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); @@ -302,7 +302,7 @@ public final class Backup extends Command { if (backupProfile instanceof NullBackupProfile) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_other") + Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) ); } else { backupProfile.listBackups().whenComplete((backups, throwable) -> { @@ -316,7 +316,8 @@ public final class Backup extends Command { if (number < 1 || number > backups.size()) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_invalid_choice") + Template.of("plot", + TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)) ); } else { final com.plotsquared.core.backup.Backup backup = @@ -325,7 +326,7 @@ public final class Backup extends Command { .exists(backup.getFile())) { player.sendMessage( TranslatableCaption.of("backups.backup_impossible"), - Template.of("plot", "generic.generic_invalid_choice") + Template.of("plot", TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)) ); } else { CmdConfirm.addPending(player, "/plot backup load " + number, 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 16ed7d9b1..eb7ff81d0 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java @@ -249,7 +249,8 @@ public class ComponentPresetManager { } lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse( TranslatableCaption.of("preset.preset_lore_component").getComponent(player), - Template.of("component", preset.getComponent().name().toLowerCase()) + Template.of("component", preset.getComponent().name().toLowerCase()), + Template.of("prefix", TranslatableCaption.of("core.prefix").getComponent(player)) ))); lore.removeIf(String::isEmpty); if (!lore.isEmpty()) { diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index cdc29eb0a..cf2581b50 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -126,7 +126,7 @@ "setup.setup_wrong_generator": "The specified generator does not identify as BukkitPlotGenerator - You may need to manually configure the other plugin.", "setup.setup_world_name_format": "Non [a-z0-9_.-] character in the world name: ", "setup.setup_world_apply_plotsquared": "The world you specified already exists. After restarting, new terrain will use PlotSquared, however you may need to reset the world for it to generate correctly!", - "setup.setup_partial_area": "What terrain would you like in plots?\n - NONE - No terrain at all\n - ORE - Just some ore veins and trees\n - ROAD - Terrain separated by roads\n - ALL - Entirely vanilla generation", + "setup.setup_partial_area": "What terrain would you like in plots?\n - NONE - No terrain at all\n - ORE - Just some ore veins and trees\n - ROAD - Terrain separated by roads\n - ALL - Entirely vanilla generation", "setup.setup_partial_area_error": "You must choose the terrain!", "setup.setup_area_name": "What would you like this area called?", "setup.setup_area_non_alphanumerical": "The area ID must be alphanumerical!", @@ -429,10 +429,10 @@ "preset.preset_invalid": "Could not generate a pattern from that preset.", "preset.preset_lore_cost": "Cost: ", "preset.preset_lore_component": "Component: ", - "generic.generic_other": "other", - "generic.generic_merged": "merged", - "generic.generic_unowned": "unowned", - "generic.generic_invalid_choice": "invalid choice", + "generic.generic_other": "other", + "generic.generic_merged": "merged", + "generic.generic_unowned": "unowned", + "generic.generic_invalid_choice": "invalid choice", "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.", diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cfd286bf7..31278fc96 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ gson = "2.8.0" snakeyaml = "1.27" adventure-api = "4.7.0" -adventure-text-minimessage = "4.0.0-SNAPSHOT" +adventure-text-minimessage = "4.1.0-SNAPSHOT" adventure-platform-bukkit = "4.0.0-SNAPSHOT" guice = "5.0.1"