Fix exit on main thread deadlock (#1256)

This commit is contained in:
IzzelAliz 2024-03-10 13:16:37 +08:00
parent 7554962fa9
commit 0f2ca4bf18
3 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,17 @@
package io.izzel.arclight.common.mixin.core.server;
import net.minecraft.server.MinecraftServer;
import org.spigotmc.AsyncCatcher;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = "net/minecraft/server/Main$1")
public class Main_ServerShutdownThreadMixin {
@Redirect(method = "run", at = @At(value = "INVOKE", remap = true, target = "Lnet/minecraft/server/MinecraftServer;halt(Z)V"))
private void arclight$shutdown(MinecraftServer instance, boolean b) {
AsyncCatcher.enabled = false;
instance.close();
}
}

View File

@ -49,6 +49,7 @@
"network.rcon.RConConsoleSourceMixin",
"server.BootstrapMixin",
"server.CustomServerBossInfoMixin",
"server.Main_ServerShutdownThreadMixin",
"server.MinecraftServerMixin",
"server.PlayerAdvancementsMixin",
"server.ServerFunctionManagerMixin",

View File

@ -202,6 +202,7 @@ task runProdServer(type: JavaExec) {
classpath = files(tasks.jar)
systemProperties 'terminal.ansi': 'true'
systemProperties 'mixin.debug.export': 'true'
systemProperties 'mixin.dumpTargetOnFailure': 'true'
systemProperties 'arclight.alwaysExtract': 'true'
systemProperties 'arclight.remapper.dump': './.mixin.out/plugin_classes'
workingDir System.env.ARCLIGHT_PROD_DIR ?: file('run_prod')