Some cleanup and comments...
This commit is contained in:
parent
f7d8a7a854
commit
599fdb9a19
@ -40,6 +40,6 @@ public class Statics {
|
|||||||
public final static DateTimeFormatter defaultDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss");
|
public final static DateTimeFormatter defaultDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss");
|
||||||
|
|
||||||
public static final AtomicBoolean globalShutdownBackupFlag = new AtomicBoolean(true);
|
public static final AtomicBoolean globalShutdownBackupFlag = new AtomicBoolean(true);
|
||||||
public static AwaitThread restoreAwaitThread;
|
public static AwaitThread restoreAwaitThread = null;
|
||||||
public static File untouchableFile;
|
public static File untouchableFile;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package net.szum123321.textile_backup.core;
|
package net.szum123321.textile_backup.core;
|
||||||
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
@ -20,6 +20,9 @@ package net.szum123321.textile_backup.core.restore;
|
|||||||
|
|
||||||
import net.szum123321.textile_backup.Statics;
|
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 {
|
public class AwaitThread extends Thread {
|
||||||
private final int delay;
|
private final int delay;
|
||||||
private final Runnable taskRunnable;
|
private final Runnable taskRunnable;
|
||||||
@ -31,7 +34,7 @@ public class AwaitThread extends Thread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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 ♪
|
// 𝄞 This is final count down! Tu ruru Tu, Tu Ru Tu Tu ♪
|
||||||
try {
|
try {
|
||||||
|
@ -21,12 +21,14 @@ package net.szum123321.textile_backup.mixin;
|
|||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.szum123321.textile_backup.core.LivingServer;
|
import net.szum123321.textile_backup.core.LivingServer;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
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.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(MinecraftServer.class)
|
@Mixin(MinecraftServer.class)
|
||||||
public class MinecraftServerMixin implements LivingServer {
|
public class MinecraftServerMixin implements LivingServer {
|
||||||
|
@Unique
|
||||||
private boolean isAlive = true;
|
private boolean isAlive = true;
|
||||||
|
|
||||||
@Inject(method = "shutdown", at = @At("TAIL"))
|
@Inject(method = "shutdown", at = @At("TAIL"))
|
||||||
@ -34,6 +36,7 @@ public class MinecraftServerMixin implements LivingServer {
|
|||||||
isAlive = false;
|
isAlive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Unique
|
||||||
@Override
|
@Override
|
||||||
public boolean isAlive() {
|
public boolean isAlive() {
|
||||||
return isAlive;
|
return isAlive;
|
||||||
|
Loading…
Reference in New Issue
Block a user