diff --git a/src/main/java/net/szum123321/textile_backup/core/LivingServer.java b/src/main/java/net/szum123321/textile_backup/core/LivingServer.java deleted file mode 100644 index 0011d6b..0000000 --- a/src/main/java/net/szum123321/textile_backup/core/LivingServer.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * A simple backup mod for Fabric - * Copyright (C) 2021 Szum123321 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.szum123321.textile_backup.core; - -public interface LivingServer { - boolean isAlive(); -} diff --git a/src/main/java/net/szum123321/textile_backup/core/restore/decompressors/GenericTarDecompressor.java b/src/main/java/net/szum123321/textile_backup/core/restore/decompressors/GenericTarDecompressor.java index 216c2e8..f87f829 100644 --- a/src/main/java/net/szum123321/textile_backup/core/restore/decompressors/GenericTarDecompressor.java +++ b/src/main/java/net/szum123321/textile_backup/core/restore/decompressors/GenericTarDecompressor.java @@ -59,9 +59,8 @@ public class GenericTarDecompressor { } else { Files.createDirectories(file.getParent()); try (OutputStream outputStream = Files.newOutputStream(file); - HashingOutputStream hashingStream = new HashingOutputStream(outputStream, file, null, treeBuilder); - BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(hashingStream)) { - IOUtils.copy(archiveInputStream, bufferedOutputStream); + HashingOutputStream out = new HashingOutputStream(outputStream, file, treeBuilder)) { + IOUtils.copy(archiveInputStream, out); } } } diff --git a/src/main/java/net/szum123321/textile_backup/core/restore/decompressors/ZipDecompressor.java b/src/main/java/net/szum123321/textile_backup/core/restore/decompressors/ZipDecompressor.java index 9ad58cf..f67ec96 100644 --- a/src/main/java/net/szum123321/textile_backup/core/restore/decompressors/ZipDecompressor.java +++ b/src/main/java/net/szum123321/textile_backup/core/restore/decompressors/ZipDecompressor.java @@ -52,9 +52,8 @@ public class ZipDecompressor { } else { Files.createDirectories(file.getParent()); try (OutputStream outputStream = Files.newOutputStream(file); - HashingOutputStream hashingStream = new HashingOutputStream(outputStream, file, null, hashBuilder); - BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(hashingStream)) { - IOUtils.copy(zipFile.getInputStream(entry), bufferedOutputStream); + HashingOutputStream out = new HashingOutputStream(outputStream, file, hashBuilder)) { + IOUtils.copy(zipFile.getInputStream(entry), out); } } } diff --git a/src/main/java/net/szum123321/textile_backup/mixin/MinecraftServerMixin.java b/src/main/java/net/szum123321/textile_backup/mixin/MinecraftServerMixin.java deleted file mode 100644 index 758ba84..0000000 --- a/src/main/java/net/szum123321/textile_backup/mixin/MinecraftServerMixin.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - A simple backup mod for Fabric - Copyright (C) 2020 Szum123321 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -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")) - public void onFinalWorldSave(CallbackInfo ci) { - isAlive = false; - } - - @Unique - @Override - public boolean isAlive() { - return isAlive; - } -} diff --git a/src/main/resources/textile_backup.mixins.json b/src/main/resources/textile_backup.mixins.json index 82c2d00..6222ec9 100644 --- a/src/main/resources/textile_backup.mixins.json +++ b/src/main/resources/textile_backup.mixins.json @@ -4,7 +4,6 @@ "compatibilityLevel": "JAVA_16", "mixins": [ "DedicatedServerWatchdogMixin", - "MinecraftServerMixin", "MinecraftServerSessionAccessor" ], "client": [