now ported to 20w14a
This commit is contained in:
parent
13436baaec
commit
7611784d86
@ -22,6 +22,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.szum123321.textile_backup.core.BackupHelper;
|
||||
|
||||
public class CleanupCommand {
|
||||
@ -31,7 +32,7 @@ public class CleanupCommand {
|
||||
}
|
||||
|
||||
private static int execute(ServerCommandSource source){
|
||||
BackupHelper.executeFileLimit(source, source.getMinecraftServer().getLevelName());
|
||||
BackupHelper.executeFileLimit(source, source.getMinecraftServer().getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName());
|
||||
source.sendFeedback(new LiteralText("Done"), false);
|
||||
|
||||
return 1;
|
||||
|
@ -45,7 +45,7 @@ public class MakeBackupThread implements Runnable {
|
||||
.getWorldDir();
|
||||
|
||||
File outFile = BackupHelper
|
||||
.getBackupRootPath(server.getLevelName())
|
||||
.getBackupRootPath(server.getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName())
|
||||
.toPath()
|
||||
.resolve(getFileName())
|
||||
.toFile();
|
||||
@ -61,7 +61,7 @@ public class MakeBackupThread implements Runnable {
|
||||
|
||||
Compressor.createArchive(world, outFile, ctx);
|
||||
|
||||
BackupHelper.executeFileLimit(ctx, server.getLevelName());
|
||||
BackupHelper.executeFileLimit(ctx, server.getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName());
|
||||
|
||||
Utilities.log("Done!", ctx);
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
public abstract class MinecraftServerMixin {
|
||||
@Shadow private long timeReference;
|
||||
@ -37,7 +39,7 @@ public abstract class MinecraftServerMixin {
|
||||
private long lastBackup = 0;
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"))
|
||||
public void tick(CallbackInfo ci){
|
||||
public void tick(BooleanSupplier shouldKeepTicking, CallbackInfo ci){
|
||||
if(timeReference - lastBackup >= TextileBackup.config.backupInterval * 1000){
|
||||
if(getPlayerManager().getCurrentPlayerCount() == 0 && !TextileBackup.config.doBackupsOnEmptyServer)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user