Translate all backup failure reasons

This commit is contained in:
Alexander Söderberg 2020-05-10 16:39:14 +02:00
parent cdab52fcbe
commit 59f96d4455
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678
2 changed files with 15 additions and 8 deletions

View File

@ -115,15 +115,15 @@ public final class Backup extends Command {
if (plot == null) {
sendMessage(player, Captions.NOT_IN_PLOT);
} else if (!plot.hasOwner()) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "unowned");
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_UNOWNED);
} else if (plot.isMerged()) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "merged");
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_MERGED.getTranslated());
} else if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER);
} else {
final BackupProfile backupProfile = Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot);
if (backupProfile instanceof NullBackupProfile) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "other");
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_OTHER.getTranslated());
} else {
backupProfile.createBackup().whenComplete((backup, throwable) -> {
if (throwable != null) {
@ -149,15 +149,15 @@ public final class Backup extends Command {
if (plot == null) {
sendMessage(player, Captions.NOT_IN_PLOT);
} else if (!plot.hasOwner()) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "unowned");
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_UNOWNED);
} else if (plot.isMerged()) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "merged");
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_MERGED.getTranslated());
} else if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER);
} else {
final BackupProfile backupProfile = Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot);
if (backupProfile instanceof NullBackupProfile) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "other");
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_OTHER.getTranslated());
} else {
backupProfile.listBackups().whenComplete((backups, throwable) -> {
// TODO: List backups
@ -179,8 +179,9 @@ public final class Backup extends Command {
if (plot == null) {
sendMessage(player, Captions.NOT_IN_PLOT);
} else if (!plot.hasOwner()) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "unowned");
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_UNOWNED);
} else if (plot.isMerged()) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_MERGED.getTranslated());
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "merged");
} else if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER);
@ -196,7 +197,7 @@ public final class Backup extends Command {
}
final BackupProfile backupProfile = Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot);
if (backupProfile instanceof NullBackupProfile) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "other");
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_OTHER.getTranslated());
} else {
backupProfile.listBackups().whenComplete((backups, throwable) -> {
// TODO: Load backups

View File

@ -770,6 +770,12 @@ public enum Captions implements Caption {
BACKUP_LOAD_USAGE("$1Usage: $2/plot backup load [#]", "Backups"),
//</editor-fold>
//<editor-fold desc="Generic">
GENERIC_OTHER("other", "Generic"),
GENERIC_MERGED("merged", "Generic"),
GENERIC_UNOWNED("unowned", "Generic"),
//</editor-fold>
/**
* Legacy Configuration Conversion
*/