mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Translate all backup failure reasons
This commit is contained in:
parent
cdab52fcbe
commit
59f96d4455
@ -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
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user