bugfix + typos

This commit is contained in:
Szum123321 2022-11-06 10:59:03 +01:00
parent 015184a232
commit 2f11548fef
6 changed files with 17 additions and 13 deletions

View File

@ -40,7 +40,9 @@ public final class FileSuggestionProvider implements SuggestionProvider<ServerCo
public CompletableFuture<Suggestions> getSuggestions(CommandContext<ServerCommandSource> ctx, SuggestionsBuilder builder) {
String remaining = builder.getRemaining();
for (RestoreableFile file : RestoreHelper.getAvailableBackups(ctx.getSource().getServer())) {
var files = RestoreHelper.getAvailableBackups(ctx.getSource().getServer());
for (RestoreableFile file: files) {
String formattedCreationTime = file.getCreationTime().format(Globals.defaultDateTimeFormatter);
if (formattedCreationTime.startsWith(remaining)) {

View File

@ -83,8 +83,8 @@ public class RestoreableFile implements Comparable<RestoreableFile> {
String comment = null;
if(filename.contains("#")) {
comment = filename.substring(filename.indexOf("#"), parsed_pos);
parsed_pos -= comment.length() - 1;
comment = filename.substring(filename.indexOf("#") + 1, parsed_pos);
parsed_pos -= comment.length() + 1;
}
var time_string = filename.substring(0, parsed_pos);

View File

@ -44,9 +44,8 @@ public class Utilities {
private final static ConfigHelper config = ConfigHelper.INSTANCE;
private final static TextileLogger log = new TextileLogger(TextileBackup.MOD_NAME);
public static boolean wasSentByPlayer(ServerCommandSource source) {
return source.isExecutedByPlayer();
}
//I'm keeping this wrapper function for easier backporting
public static boolean wasSentByPlayer(ServerCommandSource source) { return source.isExecutedByPlayer(); }
public static void notifyPlayers(@NotNull MinecraftServer server, String msg) {
MutableText message = log.getPrefixText();
@ -104,11 +103,13 @@ public class Utilities {
if (config.get().perWorldBackup) path = path.resolve(worldName);
if(Files.notExists(path)) {
try {
Files.createDirectories(path);
} catch (IOException e) {
//I REALLY shouldn't be handling this here
}
}
return path;
}

View File

@ -115,7 +115,7 @@ public class MakeBackupRunnable implements Runnable {
log.sendInfoAL(context, "Done!");
}
} catch (Throwable e) {
//ExecutorService swallows exception, so I need to catch everythin
//ExecutorService swallows exception, so I need to catch everything
log.error("An exception occurred when trying to create new backup file!", e);
if(context.initiator() == ActionInitiator.Player)

View File

@ -59,6 +59,7 @@ public class RestoreBackupRunnable implements Runnable {
MakeBackupRunnableFactory.create(
BackupContext.Builder
.newBackupContextBuilder()
.saveServer()
.setServer(ctx.server())
.setInitiator(ActionInitiator.Restore)
.setComment("Old_World" + (ctx.comment() != null ? "_" + ctx.comment() : ""))

View File

@ -24,7 +24,7 @@
"text.autoconfig.textile_backup.option.perWorldBackup": "Use separate folders for different worlds",
"text.autoconfig.textile_backup.option.path": "Path to backup folder",
"text.autoconfig.textile_backup.option.backupDirectoryPath": "Path to backup folder",
"text.autoconfig.textile_backup.option.fileBlacklist": "Blacklisted files",
@ -36,7 +36,7 @@
"text.autoconfig.textile_backup.option.maxAge.@Tooltip": "In seconds since creation",
"text.autoconfig.textile_backup.option.maxSize": "Max size of backup folder",
"text.autoconfig.textile_backup.option.maxSize.@Tooltip": "In KBytes",
"text.autoconfig.textile_backup.option.maxSize.@Tooltip": "In KiBytes",
"text.autoconfig.textile_backup.option.compression": "Compression level",
"text.autoconfig.textile_backup.option.compression.@Tooltip": "Only affects zip",