Moved LivingServer duck interface to core package

2.x-1.16
szymon 2020-08-04 18:00:10 +02:00
parent 1141c3500a
commit d28123aacc
2 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
package net.szum123321.textile_backup;
package net.szum123321.textile_backup.core;
public interface LivingServer {
boolean isAlive();

View File

@ -19,7 +19,7 @@
package net.szum123321.textile_backup.mixin;
import net.minecraft.server.MinecraftServer;
import net.szum123321.textile_backup.LivingServer;
import net.szum123321.textile_backup.core.LivingServer;
import net.szum123321.textile_backup.TextileBackup;
import net.szum123321.textile_backup.core.create.BackupContext;
import net.szum123321.textile_backup.core.create.BackupHelper;
@ -34,16 +34,17 @@ public class MinecraftServerMixin implements LivingServer {
@Inject(method = "shutdown", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/server/MinecraftServer;save(ZZZ)Z"))
public void onFinalWorldSave(CallbackInfo ci) {
if (TextileBackup.CONFIG.shutdownBackup && TextileBackup.globalShutdownBackupFlag.get())
if (TextileBackup.CONFIG.shutdownBackup && TextileBackup.globalShutdownBackupFlag.get()) {
TextileBackup.executorService.submit(
BackupHelper.create(
new BackupContext.Builder()
.setServer((MinecraftServer)(Object) this)
.setInitiator(BackupContext.BackupInitiator.Shutdown)
.setComment("shutdown")
.build()
)
new BackupContext.Builder()
.setServer((MinecraftServer) (Object) this)
.setInitiator(BackupContext.BackupInitiator.Shutdown)
.setComment("shutdown")
.build()
)
);
}
isAlive = false;
}