Skip to content

Commit

Permalink
Crash on failed startup
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Sep 23, 2023
1 parent 449a275 commit f1e9037
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/mctester/mixin/fixes/startup_crash/MainMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package mctester.mixin.fixes.startup_crash;

import net.minecraft.server.Main;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Main.class)
public class MainMixin {

@Inject(
method = "main", remap = false,
at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Lorg/slf4j/Marker;Ljava/lang/String;Ljava/lang/Throwable;)V")
)
private static void crashServerStartup(String[] args, CallbackInfo ci) {
throw new IllegalStateException("Server startup failed!");
}
}
1 change: 1 addition & 0 deletions src/main/resources/mctester.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"fixes.function_lookup.TestCommandMixin",
"fixes.function_lookup.TestRunnerMixin",
"fixes.rotation.TestCommandMixin",
"fixes.startup_crash.MainMixin",
"startup.Autostart_MinecraftServerMixin",
"startup.SharedConstantsMixin"
],
Expand Down

0 comments on commit f1e9037

Please sign in to comment.