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