Style correction, removed unnecessary constructors from records
parent
8858bd498b
commit
47f8c5cbc3
|
@ -24,17 +24,11 @@ import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.szum123321.textile_backup.core.ActionInitiator;
|
import net.szum123321.textile_backup.core.ActionInitiator;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public record BackupContext(MinecraftServer server,
|
public record BackupContext(@NotNull MinecraftServer server,
|
||||||
ServerCommandSource commandSource,
|
ServerCommandSource commandSource,
|
||||||
ActionInitiator initiator, boolean save,
|
ActionInitiator initiator,
|
||||||
|
boolean save,
|
||||||
String comment) {
|
String comment) {
|
||||||
public BackupContext(@NotNull MinecraftServer server, ServerCommandSource commandSource, @NotNull ActionInitiator initiator, boolean save, String comment) {
|
|
||||||
this.server = server;
|
|
||||||
this.commandSource = commandSource;
|
|
||||||
this.initiator = initiator;
|
|
||||||
this.save = save;
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MinecraftServer getServer() {
|
public MinecraftServer getServer() {
|
||||||
return server;
|
return server;
|
||||||
|
|
|
@ -52,11 +52,10 @@ public class BackupHelper {
|
||||||
|
|
||||||
builder.append(ctx.getInitiator().getPrefix());
|
builder.append(ctx.getInitiator().getPrefix());
|
||||||
|
|
||||||
if(ctx.startedByPlayer()) {
|
if(ctx.startedByPlayer())
|
||||||
builder.append(ctx.getCommandSource().getDisplayName().getString());
|
builder.append(ctx.getCommandSource().getDisplayName().getString());
|
||||||
} else {
|
else
|
||||||
builder.append(ctx.getInitiator().getName());
|
builder.append(ctx.getInitiator().getName());
|
||||||
}
|
|
||||||
|
|
||||||
builder.append(" on: ");
|
builder.append(" on: ");
|
||||||
builder.append(Utilities.getDateTimeFormatter().format(LocalDateTime.now()));
|
builder.append(Utilities.getDateTimeFormatter().format(LocalDateTime.now()));
|
||||||
|
|
|
@ -60,11 +60,12 @@ public abstract class AbstractCompressor {
|
||||||
|
|
||||||
finish(arc);
|
finish(arc);
|
||||||
} catch(NoSpaceLeftOnDeviceException e) {
|
} catch(NoSpaceLeftOnDeviceException e) {
|
||||||
log.error("CRITICAL ERROR OCCURRED!");
|
log.error("""
|
||||||
log.error("The backup is corrupted.");
|
CRITICAL ERROR OCCURRED!
|
||||||
log.error("Don't panic! This is a known issue!");
|
The backup is corrupted.;
|
||||||
log.error("For help see: https://github.com/Szum123321/textile_backup/wiki/ZIP-Problems");
|
Don't panic! This is a known issue!
|
||||||
log.error("In case this isn't it here's also the exception itself!", e);
|
For help see: https://github.com/Szum123321/textile_backup/wiki/ZIP-Problems
|
||||||
|
In case this isn't it here's also the exception itself!""", e);
|
||||||
|
|
||||||
if(ctx.getInitiator() == ActionInitiator.Player) {
|
if(ctx.getInitiator() == ActionInitiator.Player) {
|
||||||
log.sendError(ctx, "Backup failed. The file is corrupt.");
|
log.sendError(ctx, "Backup failed. The file is corrupt.");
|
||||||
|
|
|
@ -82,8 +82,7 @@ public class RestoreBackupRunnable implements Runnable {
|
||||||
if(config.get().deleteOldBackupAfterRestore) {
|
if(config.get().deleteOldBackupAfterRestore) {
|
||||||
log.info("Deleting old backup");
|
log.info("Deleting old backup");
|
||||||
|
|
||||||
if(!ctx.getFile().getFile().delete())
|
if(!ctx.getFile().getFile().delete()) log.info("Something went wrong while deleting old backup");
|
||||||
log.info("Something went wrong while deleting old backup");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//in case we're playing on client
|
//in case we're playing on client
|
||||||
|
|
|
@ -26,16 +26,10 @@ import net.szum123321.textile_backup.core.ActionInitiator;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public record RestoreContext(RestoreHelper.RestoreableFile file,
|
public record RestoreContext(RestoreHelper.RestoreableFile file,
|
||||||
MinecraftServer server, @Nullable String comment,
|
MinecraftServer server,
|
||||||
|
@Nullable String comment,
|
||||||
ActionInitiator initiator,
|
ActionInitiator initiator,
|
||||||
ServerCommandSource commandSource) {
|
ServerCommandSource commandSource) {
|
||||||
public RestoreContext(RestoreHelper.RestoreableFile file, MinecraftServer server, @Nullable String comment, ActionInitiator initiator, ServerCommandSource commandSource) {
|
|
||||||
this.file = file;
|
|
||||||
this.server = server;
|
|
||||||
this.comment = comment;
|
|
||||||
this.initiator = initiator;
|
|
||||||
this.commandSource = commandSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RestoreHelper.RestoreableFile getFile() {
|
public RestoreHelper.RestoreableFile getFile() {
|
||||||
return file;
|
return file;
|
||||||
|
|
Loading…
Reference in New Issue