-
Bug
-
Resolution: Invalid
-
None
-
1.20.4, 24w05b
-
Plausible
-
Commands, Dedicated Server
Description of bug
I am creating a command to be used in the mod; the logic to throw a special java.lang.Throwable that is able to throw in the runtime such as java.lang.Error is defined in the command, and I did not implement any handling exceptions.
The problem is that when Minecraft Server handles execution of the command sent by the player, it doesn't handle any java.lang.Error. Meanwhile, if the command is entered in the console of Dedicated Server, the server makes a crash as intended.
To reproduce, we should use a modified Minecraft version in the present, but it may also happen enough in the Vanilla environment.
Step to reproduce
On Integrated Server (Singleplayer world)
- Install Fabric to the client
- Apply the mod in Attachment 1 to move under .minecraft/mods directory
- Also apply Fabric API mod
- Creating a new world or join existing
- Enter test command
- See the server doesn't make a crash and continues
On Dedicated Server
- Install Fabric Server
- Apply the mod in Attachment 1 to move under .minecraft/mods directory
- Also apply Fabric API mod
- Write script to run the server and execute it
- Agree the EULA and re-run the server
- Check the server has done the startup and join the server
- Enter test command
- See the server doesn't make a crash and continues
Expected result
Server crashes and makes a crash report.
Attachments
Attachment 1
[command/crash-test] 1.0.0-SNAPSHOT for Fabric
The test mod to reproduce the bug.
Command Information
/test | |
---|---|
Permission level required | 4 |
Restrictions | None |
Command Syntax
- test
Attachment 2
import com.mojang.brigadier.CommandDispatcher; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.minecraft.command.CommandRegistryAccess; import net.minecraft.server.command.CommandManager; import net.minecraft.server.command.ServerCommandSource; public class TestCommand implements ModInitializer, CommandRegistrationCallback { @Override public void onInitialize() { CommandRegistrationCallback.EVENT.register(this); } @Override public void register( CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess, CommandManager.RegistrationEnvironment environment ) { dispatcher.register( CommandManager.literal("test") .requires(source -> source.hasPermissionLevel(CommandManager.field_31841)) .executes(ctx -> { throw new Error("Manually triggered debug crash"); }) ); } }
Source code of the test mod.