Add prefixes and make FAWE more translatable

This commit is contained in:
NotMyFault
2019-04-07 01:13:23 +02:00
parent 6558e549fd
commit ab3394c35e
16 changed files with 110 additions and 90 deletions

View File

@ -68,7 +68,7 @@ public class SnapshotCommands {
LocalConfiguration config = we.getConfiguration();
if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
BBC.SNAPSHOT_NOT_CONFIGURED.send(player);
return;
}
@ -86,22 +86,22 @@ public class SnapshotCommands {
BBC.SNAPSHOT_LIST_FOOTER.send(player);
} else {
player.printError("No snapshots are available. See console for details.");
BBC.SNAPSHOT_NOT_AVAILABLE.send(player);
// Okay, let's toss some debugging information!
File dir = config.snapshotRepo.getDirectory();
try {
WorldEdit.logger.info("WorldEdit found no snapshots: looked in: "
WorldEdit.logger.info(BBC.getPrefix() + "WorldEdit found no snapshots: looked in: "
+ dir.getCanonicalPath());
} catch (IOException e) {
WorldEdit.logger.info("WorldEdit found no snapshots: looked in "
WorldEdit.logger.info(BBC.getPrefix() + "WorldEdit found no snapshots: looked in "
+ "(NON-RESOLVABLE PATH - does it exist?): "
+ dir.getPath());
}
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
}
}
@ -118,7 +118,7 @@ public class SnapshotCommands {
LocalConfiguration config = we.getConfiguration();
if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
BBC.SNAPSHOT_NOT_CONFIGURED.send(player);
return;
}
@ -133,17 +133,17 @@ public class SnapshotCommands {
session.setSnapshot(null);
BBC.SNAPSHOT_NEWEST.send(player);
} else {
player.printError("No snapshots were found.");
BBC.SNAPSHOT_NOT_FOUND.send(player);
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
}
} else {
try {
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
BBC.SNAPSHOT_SET.send(player, name);
} catch (InvalidSnapshotException e) {
player.printError("That snapshot does not exist or is not available.");
BBC.SNAPSHOT_NOT_AVAILABLE.send(player);
}
}
}
@ -160,7 +160,7 @@ public class SnapshotCommands {
LocalConfiguration config = we.getConfiguration();
if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
BBC.SNAPSHOT_NOT_CONFIGURED.send(player);
return;
}
@ -168,30 +168,30 @@ public class SnapshotCommands {
try {
index = Integer.parseInt(args.getString(0));
} catch (NumberFormatException e) {
player.printError("Invalid index, " + args.getString(0) + " is not a valid integer.");
player.printError(BBC.getPrefix() + "Invalid index, " + args.getString(0) + " is not a valid integer.");
return;
}
if (index < 1) {
player.printError("Invalid index, must be equal or higher then 1.");
BBC.SNAPSHOT_INVALID_INDEX.send(player);
return;
}
try {
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName());
if (snapshots.size() < index) {
player.printError("Invalid index, must be between 1 and " + snapshots.size() + ".");
player.printError(BBC.getPrefix() + "Invalid index, must be between 1 and " + snapshots.size() + ".");
return;
}
Snapshot snapshot = snapshots.get(index - 1);
if (snapshot == null) {
player.printError("That snapshot does not exist or is not available.");
BBC.SNAPSHOT_NOT_AVAILABLE.send(player);
return;
}
session.setSnapshot(snapshot);
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
} catch (MissingWorldException e) {
player.printError("No snapshots were found for this world.");
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
}
}
@ -208,28 +208,28 @@ public class SnapshotCommands {
LocalConfiguration config = we.getConfiguration();
if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
BBC.SNAPSHOT_NOT_CONFIGURED.send(player);
return;
}
Calendar date = session.detectDate(args.getJoinedStrings(0));
if (date == null) {
player.printError("Could not detect the date inputted.");
BBC.SNAPSHOT_ERROR_DATE.send(player);
} else {
try {
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, player.getWorld().getName());
if (snapshot == null) {
dateFormat.setTimeZone(session.getTimeZone());
player.printError("Couldn't find a snapshot before "
player.printError(BBC.getPrefix() + "Couldn't find a snapshot before "
+ dateFormat.format(date.getTime()) + ".");
} else {
session.setSnapshot(snapshot);
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
}
}
}
@ -247,27 +247,27 @@ public class SnapshotCommands {
LocalConfiguration config = we.getConfiguration();
if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
BBC.SNAPSHOT_NOT_CONFIGURED.send(player);
return;
}
Calendar date = session.detectDate(args.getJoinedStrings(0));
if (date == null) {
player.printError("Could not detect the date inputted.");
BBC.SNAPSHOT_ERROR_DATE.send(player);
} else {
try {
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, player.getWorld().getName());
if (snapshot == null) {
dateFormat.setTimeZone(session.getTimeZone());
player.printError("Couldn't find a snapshot after "
player.printError(BBC.getPrefix() + "Couldn't find a snapshot after "
+ dateFormat.format(date.getTime()) + ".");
} else {
session.setSnapshot(snapshot);
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
}
}
}