Some cleanup and comments...

This commit is contained in:
szymon 2020-09-13 20:41:23 +02:00
parent f7d8a7a854
commit 599fdb9a19
4 changed files with 8 additions and 3 deletions

View File

@ -40,6 +40,6 @@ public class Statics {
public final static DateTimeFormatter defaultDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss");
public static final AtomicBoolean globalShutdownBackupFlag = new AtomicBoolean(true);
public static AwaitThread restoreAwaitThread;
public static AwaitThread restoreAwaitThread = null;
public static File untouchableFile;
}

View File

@ -18,7 +18,6 @@
package net.szum123321.textile_backup.core;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;

View File

@ -20,6 +20,9 @@ package net.szum123321.textile_backup.core.restore;
import net.szum123321.textile_backup.Statics;
/*
This thread waits some amount of time and then starts a new, independent thread
*/
public class AwaitThread extends Thread {
private final int delay;
private final Runnable taskRunnable;
@ -31,7 +34,7 @@ public class AwaitThread extends Thread {
@Override
public void run() {
Statics.LOGGER.info("Countdown begins...");
Statics.LOGGER.info("Countdown begins... Waiting {} second.", delay);
// 𝄞 This is final count down! Tu ruru Tu, Tu Ru Tu Tu
try {

View File

@ -21,12 +21,14 @@ package net.szum123321.textile_backup.mixin;
import net.minecraft.server.MinecraftServer;
import net.szum123321.textile_backup.core.LivingServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftServer.class)
public class MinecraftServerMixin implements LivingServer {
@Unique
private boolean isAlive = true;
@Inject(method = "shutdown", at = @At("TAIL"))
@ -34,6 +36,7 @@ public class MinecraftServerMixin implements LivingServer {
isAlive = false;
}
@Unique
@Override
public boolean isAlive() {
return isAlive;