Fix backup captions and add placeholders to copy/move/swap

This commit is contained in:
NotMyFault 2021-03-30 13:44:04 +02:00
parent 3f05dfe4bf
commit 567f1d4247
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
5 changed files with 21 additions and 18 deletions

View File

@ -141,14 +141,14 @@ public final class Backup extends Command {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_unowned") Template.of("plot", "generic.generic_unowned")
); );
} 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("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_merged") Template.of("plot", "generic.generic_merged")
); );
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
@ -161,7 +161,7 @@ public final class Backup extends Command {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_other") Template.of("plot", "generic.generic_other")
); );
} else { } else {
@ -195,12 +195,12 @@ public final class Backup extends Command {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_unowned") Template.of("plot", "generic.generic_unowned")
); );
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_merged") Template.of("plot", "generic.generic_merged")
); );
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
@ -215,7 +215,7 @@ public final class Backup extends Command {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_other") Template.of("plot", "generic.generic_other")
); );
} else { } else {
@ -266,12 +266,12 @@ public final class Backup extends Command {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_unowned") Template.of("plot", "generic.generic_unowned")
); );
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_merged") Template.of("plot", "generic.generic_merged")
); );
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
@ -301,7 +301,7 @@ public final class Backup extends Command {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_other") Template.of("plot", "generic.generic_other")
); );
} else { } else {
@ -315,7 +315,7 @@ public final class Backup extends Command {
} else { } else {
if (number < 1 || number > backups.size()) { if (number < 1 || number > backups.size()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_invalid_choice") Template.of("plot", "generic.generic_invalid_choice")
); );
} else { } else {
@ -324,7 +324,7 @@ public final class Backup extends Command {
if (backup == null || backup.getFile() == null || !Files if (backup == null || backup.getFile() == null || !Files
.exists(backup.getFile())) { .exists(backup.getFile())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backup_impossible"), TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", "generic.generic_invalid_choice") Template.of("plot", "generic.generic_invalid_choice")
); );
} else { } else {

View File

@ -80,7 +80,8 @@ public class Copy extends SubCommand {
plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> { plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> {
if (result) { if (result) {
player.sendMessage(TranslatableCaption.of("move.copy_success")); player.sendMessage(TranslatableCaption.of("move.copy_success"), Template.of("origin", String.valueOf(plot1)),
Template.of("target", String.valueOf(plot2)));
} else { } else {
player.sendMessage(TranslatableCaption.of("move.requires_unowned")); player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
} }

View File

@ -112,7 +112,8 @@ public class Move extends SubCommand {
return plot1.getPlotModificationManager().move(plot2, player, () -> { return plot1.getPlotModificationManager().move(plot2, player, () -> {
}, false).thenApply(result -> { }, false).thenApply(result -> {
if (result) { if (result) {
player.sendMessage(TranslatableCaption.of("move.move_success")); player.sendMessage(TranslatableCaption.of("move.move_success"), Template.of("origin", String.valueOf(plot1)),
Template.of("target", String.valueOf(plot2)));
return true; return true;
} else { } else {
player.sendMessage(TranslatableCaption.of("move.requires_unowned")); player.sendMessage(TranslatableCaption.of("move.requires_unowned"));

View File

@ -89,7 +89,8 @@ public class Swap extends SubCommand {
return plot1.getPlotModificationManager().move(plot2, player, () -> { return plot1.getPlotModificationManager().move(plot2, player, () -> {
}, true).thenApply(result -> { }, true).thenApply(result -> {
if (result) { if (result) {
player.sendMessage(TranslatableCaption.of("swap.swap_success")); player.sendMessage(TranslatableCaption.of("swap.swap_success"), Template.of("origin", String.valueOf(plot1)),
Template.of("target", String.valueOf(plot2)));
return true; return true;
} else { } else {
player.sendMessage(TranslatableCaption.of("swap.swap_overlap")); player.sendMessage(TranslatableCaption.of("swap.swap_overlap"));

View File

@ -2,9 +2,9 @@
"confirm.expired_confirm": "<prefix><red>Confirmation has expired, please run the command again!</red>", "confirm.expired_confirm": "<prefix><red>Confirmation has expired, please run the command again!</red>",
"confirm.failed_confirm": "<prefix><red>You have no pending actions to confirm!</red>", "confirm.failed_confirm": "<prefix><red>You have no pending actions to confirm!</red>",
"confirm.requires_confirm": "<prefix><gray>Are you sure you wish to execute: </gray><gold><command></gold><gray>?</gray>\n<red>This cannot be undone! If you are sure: </red><gray><value></gray>", "confirm.requires_confirm": "<prefix><gray>Are you sure you wish to execute: </gray><gold><command></gold><gray>?</gray>\n<red>This cannot be undone! If you are sure: </red><gray><value></gray>",
"move.move_success": "<prefix><dark_aqua>Successfully moved plot.</dark_aqua>", "move.move_success": "<prefix><dark_aqua>Successfully moved the plot</dark_aqua> <gold><origin></gold><dark_aqua> -> </dark_aqua><gold><target></gold>",
"move.move_merged": "<prefix><red>Merged plots may not be moved. Please unmerge the plot before performing the move.</red>", "move.move_merged": "<prefix><red>Merged plots may not be moved. Please unmerge the plot before performing the move.</red>",
"move.copy_success": "<prefix><dark_aqua>Successfully copied plot.</dark_aqua>", "move.copy_success": "<prefix><dark_aqua>Successfully copied plots</dark_aqua> <gold><origin></gold><dark_aqua> -> </dark_aqua><gold><target></gold>",
"move.requires_unowned": "<prefix><red>The location specified is already occupied.</red>", "move.requires_unowned": "<prefix><red>The location specified is already occupied.</red>",
"debug.requires_unmerged": "<prefix><red>The plot cannot be merged.</red>", "debug.requires_unmerged": "<prefix><red>The plot cannot be merged.</red>",
"debug.debug_header": "<prefix> <gold>Debug Information</gold>\n", "debug.debug_header": "<prefix> <gold>Debug Information</gold>\n",
@ -60,7 +60,7 @@
"notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><plot></gold><gray>).</gray>", "notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><plot></gold><gray>).</gray>",
"notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><plot></gold><gray>).</gray>", "notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><plot></gold><gray>).</gray>",
"swap.swap_overlap": "<prefix><red>The proposed areas are not allowed to overlap.</red>", "swap.swap_overlap": "<prefix><red>The proposed areas are not allowed to overlap.</red>",
"swap.swap_success": "<prefix><dark_aqua>Successfully swapped plots.</dark_aqua>", "swap.swap_success": "<prefix><dark_aqua>Successfully swapped plots</dark_aqua> <gold><origin></gold><dark_aqua> -> </dark_aqua><gold><target></gold>",
"swap.swap_merged": "<prefix><red>Merged plots may not be swapped. Please unmerge the plots before performing the swap.</red>", "swap.swap_merged": "<prefix><red>Merged plots may not be swapped. Please unmerge the plots before performing the swap.</red>",
"swap.progress_region1_copy": "<prefix><gray>Current region 1 copy progress: </gray><gold><progress></gold><gray>%</gray>", "swap.progress_region1_copy": "<prefix><gray>Current region 1 copy progress: </gray><gold><progress></gold><gray>%</gray>",
"swap.progress_region2_copy": "<prefix><gray>Current region 2 copy progress: </gray><gold><progress></gold><gray>%</gray", "swap.progress_region2_copy": "<prefix><gray>Current region 2 copy progress: </gray><gold><progress></gold><gray>%</gray",
@ -414,7 +414,7 @@
"grants.granted_plots": "<prefix><gold>Result: <gray><amount> </gray>grants left.</gold>", "grants.granted_plots": "<prefix><gold>Result: <gray><amount> </gray>grants left.</gold>",
"grants.added": "<prefix><gold><grants></gold> <gray>grant(s) have been added.</gray>", "grants.added": "<prefix><gold><grants></gold> <gray>grant(s) have been added.</gray>",
"events.event_denied": "<prefix><gold><value> </gold><gray>Cancelled by external plugin.</gray>", "events.event_denied": "<prefix><gold><value> </gold><gray>Cancelled by external plugin.</gray>",
"backups.backup_impossible": "<prefix><gray>Backups are not enabled for this plot: <plot>.</gray>", "backups.backup_impossible": "<prefix><red>Backups are not enabled for this plot: <plot>.</red>",
"backups.backup_save_success": "<prefix><gold>The backup was created successfully.</gold>", "backups.backup_save_success": "<prefix><gold>The backup was created successfully.</gold>",
"backups.backup_save_failed": "<prefix><red>The backup could not be created: </red><gray><reason></gray>", "backups.backup_save_failed": "<prefix><red>The backup could not be created: </red><gray><reason></gray>",
"backups.backup_load_success": "<prefix><gold>The backup was restored successfully.</gold>", "backups.backup_load_success": "<prefix><gold>The backup was restored successfully.</gold>",