bugfix + typos
This commit is contained in:
parent
015184a232
commit
2f11548fef
@ -40,7 +40,9 @@ public final class FileSuggestionProvider implements SuggestionProvider<ServerCo
|
|||||||
public CompletableFuture<Suggestions> getSuggestions(CommandContext<ServerCommandSource> ctx, SuggestionsBuilder builder) {
|
public CompletableFuture<Suggestions> getSuggestions(CommandContext<ServerCommandSource> ctx, SuggestionsBuilder builder) {
|
||||||
String remaining = builder.getRemaining();
|
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);
|
String formattedCreationTime = file.getCreationTime().format(Globals.defaultDateTimeFormatter);
|
||||||
|
|
||||||
if (formattedCreationTime.startsWith(remaining)) {
|
if (formattedCreationTime.startsWith(remaining)) {
|
||||||
|
@ -83,8 +83,8 @@ public class RestoreableFile implements Comparable<RestoreableFile> {
|
|||||||
String comment = null;
|
String comment = null;
|
||||||
|
|
||||||
if(filename.contains("#")) {
|
if(filename.contains("#")) {
|
||||||
comment = filename.substring(filename.indexOf("#"), parsed_pos);
|
comment = filename.substring(filename.indexOf("#") + 1, parsed_pos);
|
||||||
parsed_pos -= comment.length() - 1;
|
parsed_pos -= comment.length() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var time_string = filename.substring(0, parsed_pos);
|
var time_string = filename.substring(0, parsed_pos);
|
||||||
|
@ -44,9 +44,8 @@ public class Utilities {
|
|||||||
private final static ConfigHelper config = ConfigHelper.INSTANCE;
|
private final static ConfigHelper config = ConfigHelper.INSTANCE;
|
||||||
private final static TextileLogger log = new TextileLogger(TextileBackup.MOD_NAME);
|
private final static TextileLogger log = new TextileLogger(TextileBackup.MOD_NAME);
|
||||||
|
|
||||||
public static boolean wasSentByPlayer(ServerCommandSource source) {
|
//I'm keeping this wrapper function for easier backporting
|
||||||
return source.isExecutedByPlayer();
|
public static boolean wasSentByPlayer(ServerCommandSource source) { return source.isExecutedByPlayer(); }
|
||||||
}
|
|
||||||
|
|
||||||
public static void notifyPlayers(@NotNull MinecraftServer server, String msg) {
|
public static void notifyPlayers(@NotNull MinecraftServer server, String msg) {
|
||||||
MutableText message = log.getPrefixText();
|
MutableText message = log.getPrefixText();
|
||||||
@ -104,10 +103,12 @@ public class Utilities {
|
|||||||
|
|
||||||
if (config.get().perWorldBackup) path = path.resolve(worldName);
|
if (config.get().perWorldBackup) path = path.resolve(worldName);
|
||||||
|
|
||||||
try {
|
if(Files.notExists(path)) {
|
||||||
Files.createDirectories(path);
|
try {
|
||||||
} catch (IOException e) {
|
Files.createDirectories(path);
|
||||||
//I REALLY shouldn't be handling this here
|
} catch (IOException e) {
|
||||||
|
//I REALLY shouldn't be handling this here
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
@ -115,7 +115,7 @@ public class MakeBackupRunnable implements Runnable {
|
|||||||
log.sendInfoAL(context, "Done!");
|
log.sendInfoAL(context, "Done!");
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} 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);
|
log.error("An exception occurred when trying to create new backup file!", e);
|
||||||
|
|
||||||
if(context.initiator() == ActionInitiator.Player)
|
if(context.initiator() == ActionInitiator.Player)
|
||||||
|
@ -59,6 +59,7 @@ public class RestoreBackupRunnable implements Runnable {
|
|||||||
MakeBackupRunnableFactory.create(
|
MakeBackupRunnableFactory.create(
|
||||||
BackupContext.Builder
|
BackupContext.Builder
|
||||||
.newBackupContextBuilder()
|
.newBackupContextBuilder()
|
||||||
|
.saveServer()
|
||||||
.setServer(ctx.server())
|
.setServer(ctx.server())
|
||||||
.setInitiator(ActionInitiator.Restore)
|
.setInitiator(ActionInitiator.Restore)
|
||||||
.setComment("Old_World" + (ctx.comment() != null ? "_" + ctx.comment() : ""))
|
.setComment("Old_World" + (ctx.comment() != null ? "_" + ctx.comment() : ""))
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
"text.autoconfig.textile_backup.option.perWorldBackup": "Use separate folders for different worlds",
|
"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",
|
"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.maxAge.@Tooltip": "In seconds since creation",
|
||||||
|
|
||||||
"text.autoconfig.textile_backup.option.maxSize": "Max size of backup folder",
|
"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": "Compression level",
|
||||||
"text.autoconfig.textile_backup.option.compression.@Tooltip": "Only affects zip",
|
"text.autoconfig.textile_backup.option.compression.@Tooltip": "Only affects zip",
|
||||||
|
Loading…
Reference in New Issue
Block a user