Fix invalid backup messages & component prefix & update minimessage

This commit is contained in:
NotMyFault 2021-05-06 10:30:04 +02:00
parent b3aec8f839
commit 491a171409
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
4 changed files with 20 additions and 18 deletions

View File

@ -142,14 +142,14 @@ public final class Backup extends Command {
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), 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) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), 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 } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
@ -162,7 +162,7 @@ public final class Backup extends Command {
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_other") Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.createBackup().whenComplete((backup, throwable) -> { backupProfile.createBackup().whenComplete((backup, throwable) -> {
@ -196,12 +196,12 @@ public final class Backup extends Command {
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), 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()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), 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) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
@ -216,7 +216,7 @@ public final class Backup extends Command {
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_other") Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.listBackups().whenComplete((backups, throwable) -> { backupProfile.listBackups().whenComplete((backups, throwable) -> {
@ -267,12 +267,12 @@ public final class Backup extends Command {
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), 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()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), 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) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
@ -302,7 +302,7 @@ public final class Backup extends Command {
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_other") Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.listBackups().whenComplete((backups, throwable) -> { backupProfile.listBackups().whenComplete((backups, throwable) -> {
@ -316,7 +316,8 @@ public final class Backup extends Command {
if (number < 1 || number > backups.size()) { if (number < 1 || number > backups.size()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_invalid_choice") Template.of("plot",
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player))
); );
} else { } else {
final com.plotsquared.core.backup.Backup backup = final com.plotsquared.core.backup.Backup backup =
@ -325,7 +326,7 @@ public final class Backup extends Command {
.exists(backup.getFile())) { .exists(backup.getFile())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_invalid_choice") Template.of("plot", TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player))
); );
} else { } else {
CmdConfirm.addPending(player, "/plot backup load " + number, CmdConfirm.addPending(player, "/plot backup load " + number,

View File

@ -249,7 +249,8 @@ public class ComponentPresetManager {
} }
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse( lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
TranslatableCaption.of("preset.preset_lore_component").getComponent(player), 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); lore.removeIf(String::isEmpty);
if (!lore.isEmpty()) { if (!lore.isEmpty()) {

View File

@ -126,7 +126,7 @@
"setup.setup_wrong_generator": "<prefix><red>The specified generator does not identify as BukkitPlotGenerator</red><dark_gray> - </dark_gray><dark_green>You may need to manually configure the other plugin.</dark_green>", "setup.setup_wrong_generator": "<prefix><red>The specified generator does not identify as BukkitPlotGenerator</red><dark_gray> - </dark_gray><dark_green>You may need to manually configure the other plugin.</dark_green>",
"setup.setup_world_name_format": "<prefix><red>Non [a-z0-9_.-] character in the world name:</red><gold> ", "setup.setup_world_name_format": "<prefix><red>Non [a-z0-9_.-] character in the world name:</red><gold> ",
"setup.setup_world_apply_plotsquared": "<prefix><red>The world you specified already exists. After restarting, new terrain will use </red><gold>PlotSquared</gold><red>, however you may need to reset the world for it to generate correctly!</red>", "setup.setup_world_apply_plotsquared": "<prefix><red>The world you specified already exists. After restarting, new terrain will use </red><gold>PlotSquared</gold><red>, however you may need to reset the world for it to generate correctly!</red>",
"setup.setup_partial_area": "<prefix><gold>What terrain would you like in plots?</gold>\n<dark_gray> - </dark_gray><dark_green>NONE</dark_green><dark_gray> - </dark_gray><gray>No terrain at all</gray>\n<dark_gray> - </dark_gray><dark_green>ORE</dark_green><dark_gray> - </dark_gray><gray>Just some ore veins and trees</gray>\n<dark_gray> - </dark_gray><dark_green>ROAD</dark_green><dark_gray> - </dark_green><gray>Terrain separated by roads</gray>\n<dark_gray> - </dark_gray><dark_green>ALL</dark_green><dark_gray> - </dark_gray><gray>Entirely vanilla generation</gray>", "setup.setup_partial_area": "<prefix><gold>What terrain would you like in plots?</gold>\n<dark_gray> - </dark_gray><dark_green>NONE</dark_green><dark_gray> - </dark_gray><gray>No terrain at all</gray>\n<dark_gray> - </dark_gray><dark_green>ORE</dark_green><dark_gray> - </dark_gray><gray>Just some ore veins and trees</gray>\n<dark_gray> - </dark_gray><dark_green>ROAD</dark_green><dark_gray> - </dark_gray><gray>Terrain separated by roads</gray>\n<dark_gray> - </dark_gray><dark_green>ALL</dark_green><dark_gray> - </dark_gray><gray>Entirely vanilla generation</gray>",
"setup.setup_partial_area_error": "<prefix><red>You must choose the terrain!</red>", "setup.setup_partial_area_error": "<prefix><red>You must choose the terrain!</red>",
"setup.setup_area_name": "<prefix><gold>What would you like this area called?</gold>", "setup.setup_area_name": "<prefix><gold>What would you like this area called?</gold>",
"setup.setup_area_non_alphanumerical": "<prefix><red>The area ID must be alphanumerical!</red>", "setup.setup_area_non_alphanumerical": "<prefix><red>The area ID must be alphanumerical!</red>",
@ -429,10 +429,10 @@
"preset.preset_invalid": "<prefix><red>Could not generate a pattern from that preset.</red>", "preset.preset_invalid": "<prefix><red>Could not generate a pattern from that preset.</red>",
"preset.preset_lore_cost": "<prefix><gray>Cost: </gray><gold><cost></gold>", "preset.preset_lore_cost": "<prefix><gray>Cost: </gray><gold><cost></gold>",
"preset.preset_lore_component": "<prefix><gray>Component: </gray><gold><component></gold>", "preset.preset_lore_component": "<prefix><gray>Component: </gray><gold><component></gold>",
"generic.generic_other": "<prefix><gray>other</gray>", "generic.generic_other": "<gray>other</gray>",
"generic.generic_merged": "<prefix><gray>merged</gray>", "generic.generic_merged": "<gray>merged</gray>",
"generic.generic_unowned": "<prefix><gray>unowned</gray>", "generic.generic_unowned": "<gray>unowned</gray>",
"generic.generic_invalid_choice": "<prefix><gray>invalid choice</gray>", "generic.generic_invalid_choice": "<gray>invalid choice</gray>",
"single.single_area_missing_selection": "<prefix><red>Error! You need to select a square region.</red>", "single.single_area_missing_selection": "<prefix><red>Error! You need to select a square region.</red>",
"single.single_area_not_square": "<prefix><red>Error! Your selection needs to be a square.</red>", "single.single_area_not_square": "<prefix><red>Error! Your selection needs to be a square.</red>",
"single.single_area_overlapping": "<prefix><red>Error! Your selection overlaps with an existing plot area.</red>", "single.single_area_overlapping": "<prefix><red>Error! Your selection overlaps with an existing plot area.</red>",

View File

@ -7,7 +7,7 @@ gson = "2.8.0"
snakeyaml = "1.27" snakeyaml = "1.27"
adventure-api = "4.7.0" 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" adventure-platform-bukkit = "4.0.0-SNAPSHOT"
guice = "5.0.1" guice = "5.0.1"