Removed redundant BufferStreams and LivingServer subsystem

This commit is contained in:
Szum123321 2022-11-27 13:57:02 +01:00
parent f6cd361fff
commit afe9c8d051
5 changed files with 4 additions and 74 deletions

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package net.szum123321.textile_backup.core;
public interface LivingServer {
boolean isAlive();
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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;
}
}

View File

@ -4,7 +4,6 @@
"compatibilityLevel": "JAVA_16",
"mixins": [
"DedicatedServerWatchdogMixin",
"MinecraftServerMixin",
"MinecraftServerSessionAccessor"
],
"client": [