20w19a update
parent
d4f38b2ebe
commit
c8c370cec0
|
@ -1,12 +1,12 @@
|
||||||
# Done to increase the memory available to gradle.
|
# Done to increase the memory available to gradle.
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
|
||||||
minecraft_version=1.15.2
|
minecraft_version=20w19a
|
||||||
yarn_mappings=1.15.2+build.15
|
yarn_mappings=20w19a+build.6
|
||||||
loader_version=0.8.2+build.194
|
loader_version=0.8.2+build.194
|
||||||
|
|
||||||
#Fabric api
|
#Fabric api
|
||||||
fabric_version=0.5.1+build.294-1.15
|
fabric_version=0.10.7+build.344-1.16
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.2.0-1.15
|
mod_version = 1.2.0-1.15
|
||||||
|
|
|
@ -21,8 +21,8 @@ package net.szum123321.textile_backup.commands;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
import net.szum123321.textile_backup.core.BackupHelper;
|
import net.szum123321.textile_backup.core.BackupHelper;
|
||||||
|
import net.szum123321.textile_backup.core.Utilities;
|
||||||
|
|
||||||
public class CleanupCommand {
|
public class CleanupCommand {
|
||||||
public static LiteralArgumentBuilder<ServerCommandSource> register(){
|
public static LiteralArgumentBuilder<ServerCommandSource> register(){
|
||||||
|
@ -31,7 +31,8 @@ public class CleanupCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int execute(ServerCommandSource source){
|
private static int execute(ServerCommandSource source){
|
||||||
BackupHelper.executeFileLimit(source, source.getMinecraftServer().getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName());
|
|
||||||
|
BackupHelper.executeFileLimit(source, Utilities.getLevelName(source.getMinecraftServer()));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package net.szum123321.textile_backup.core;
|
package net.szum123321.textile_backup.core;
|
||||||
|
|
||||||
|
import net.minecraft.class_5218;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
|
@ -25,6 +26,7 @@ import net.szum123321.textile_backup.TextileBackup;
|
||||||
import net.szum123321.textile_backup.core.compressors.GenericTarCompressor;
|
import net.szum123321.textile_backup.core.compressors.GenericTarCompressor;
|
||||||
import net.szum123321.textile_backup.core.compressors.ParallelBZip2Compressor;
|
import net.szum123321.textile_backup.core.compressors.ParallelBZip2Compressor;
|
||||||
import net.szum123321.textile_backup.core.compressors.ParallelZipCompressor;
|
import net.szum123321.textile_backup.core.compressors.ParallelZipCompressor;
|
||||||
|
import net.szum123321.textile_backup.mixin.MinecraftServerSessionAccessor;
|
||||||
import org.anarres.parallelgzip.ParallelGZIPOutputStream;
|
import org.anarres.parallelgzip.ParallelGZIPOutputStream;
|
||||||
import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream;
|
import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream;
|
||||||
import org.at4j.comp.bzip2.BZip2OutputStream;
|
import org.at4j.comp.bzip2.BZip2OutputStream;
|
||||||
|
@ -46,13 +48,12 @@ public class MakeBackupThread implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
File world = server
|
File world = ((MinecraftServerSessionAccessor)server)
|
||||||
.getWorld(DimensionType.OVERWORLD)
|
.getSession()
|
||||||
.getSaveHandler()
|
.getDirectory(class_5218.field_24188).toFile();
|
||||||
.getWorldDir();
|
|
||||||
|
|
||||||
File outFile = BackupHelper
|
File outFile = BackupHelper
|
||||||
.getBackupRootPath(server.getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName())
|
.getBackupRootPath(Utilities.getLevelName(server))
|
||||||
.toPath()
|
.toPath()
|
||||||
.resolve(getFileName())
|
.resolve(getFileName())
|
||||||
.toFile();
|
.toFile();
|
||||||
|
@ -89,7 +90,7 @@ public class MakeBackupThread implements Runnable {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BackupHelper.executeFileLimit(ctx, server.getWorld(DimensionType.OVERWORLD).getLevelProperties().getLevelName());
|
BackupHelper.executeFileLimit(ctx, Utilities.getLevelName(server));
|
||||||
|
|
||||||
Utilities.log("Done!", ctx);
|
Utilities.log("Done!", ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,22 @@
|
||||||
package net.szum123321.textile_backup.core;
|
package net.szum123321.textile_backup.core;
|
||||||
|
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.server.dedicated.DedicatedServer;
|
||||||
|
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
|
||||||
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.szum123321.textile_backup.TextileBackup;
|
import net.szum123321.textile_backup.TextileBackup;
|
||||||
|
import net.szum123321.textile_backup.mixin.MinecraftServerSessionAccessor;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
public class Utilities {
|
public class Utilities {
|
||||||
|
public static String getLevelName(MinecraftServer server) {
|
||||||
|
return ((MinecraftServerSessionAccessor)server).getSession().readLevelProperties().getLevelName();
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isWindows(){
|
public static boolean isWindows(){
|
||||||
String os = System.getProperty("os.name");
|
String os = System.getProperty("os.name");
|
||||||
return os.toLowerCase().startsWith("win");
|
return os.toLowerCase().startsWith("win");
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package net.szum123321.textile_backup.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.world.level.storage.LevelStorage;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(MinecraftServer.class)
|
||||||
|
public interface MinecraftServerSessionAccessor {
|
||||||
|
@Accessor
|
||||||
|
LevelStorage.Session getSession();
|
||||||
|
}
|
|
@ -3,7 +3,8 @@
|
||||||
"package": "net.szum123321.textile_backup.mixin",
|
"package": "net.szum123321.textile_backup.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MinecraftServerMixin"
|
"MinecraftServerMixin",
|
||||||
|
"MinecraftServerSessionAccessor"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue