diff --git a/luminol-server/minecraft-patches/features/0053-Command-IllegalArgumentException-crash-fix.patch b/luminol-server/minecraft-patches/features/0053-Command-IllegalArgumentException-crash-fix.patch new file mode 100644 index 0000000..87127b5 --- /dev/null +++ b/luminol-server/minecraft-patches/features/0053-Command-IllegalArgumentException-crash-fix.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Helvetica Volubi +Date: Thu, 24 Apr 2025 20:59:52 +0800 +Subject: [PATCH] Command IllegalArgumentException crash fix + + +diff --git a/net/minecraft/server/commands/FillCommand.java b/net/minecraft/server/commands/FillCommand.java +index 89154adfc659afa188cd771e70087e3b1a9c98b9..e622f96e6e116bf491bbea39da099e02ceaee502 100644 +--- a/net/minecraft/server/commands/FillCommand.java ++++ b/net/minecraft/server/commands/FillCommand.java +@@ -210,6 +210,10 @@ public class FillCommand { + // Folia start - region threading + } catch (CommandSyntaxException ex) { + sendMessage(source, ex); ++ // Luminol Start - Server crash fix ++ } catch (IllegalArgumentException ex) { ++ net.minecraft.server.commands.SetBlockCommand.processIAE(source, ex); ++ // Luminol End - Server crash fix + } + }); return 0; // Folia end - region threading + } +diff --git a/net/minecraft/server/commands/SetBlockCommand.java b/net/minecraft/server/commands/SetBlockCommand.java +index 05b824409546ba8bacf7efdaeac106af89ff0715..5c368a70a48260accbbb94a041f4dc9dcf90db4a 100644 +--- a/net/minecraft/server/commands/SetBlockCommand.java ++++ b/net/minecraft/server/commands/SetBlockCommand.java +@@ -86,6 +86,21 @@ public class SetBlockCommand { + } + // Folia end - region threading + ++ // Luminol Start - Server crash fix ++ public static void processIAE(CommandSourceStack src, IllegalArgumentException ex) { ++ Component hoverText = Component.translatable("command.failed") ++ .withStyle(style -> style.withHoverEvent(new net.minecraft.network.chat.HoverEvent(net.minecraft.network.chat.HoverEvent.Action.SHOW_TEXT, Component.literal(ex.getMessage())))); ++ src.sendFailure(hoverText); ++ org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); ++ LOGGER.error(ex.getMessage()); ++ StringBuilder stackTrace = new StringBuilder(); ++ for (StackTraceElement element : ex.getStackTrace()) { ++ stackTrace.append(element.toString()).append("\n"); ++ } ++ LOGGER.error(stackTrace.toString()); ++ } ++ // Luminol end - Server crash fix ++ + private static int setBlock( + CommandSourceStack source, BlockPos pos, BlockInput state, SetBlockCommand.Mode mode, @Nullable Predicate predicate + ) throws CommandSyntaxException { +@@ -119,6 +134,10 @@ public class SetBlockCommand { + // Folia start - region threading + } catch (CommandSyntaxException ex) { + sendMessage(source, ex); ++ // Luminol Start - Server crash fix ++ } catch (IllegalArgumentException ex) { ++ processIAE(source, ex); ++ // Luminol End - Server crash fix + } + }); + return 1; diff --git a/luminol-server/minecraft-patches/features/0053-SetBlockCommand-crash-fix.patch b/luminol-server/minecraft-patches/features/0053-SetBlockCommand-crash-fix.patch deleted file mode 100644 index 6660ba4..0000000 --- a/luminol-server/minecraft-patches/features/0053-SetBlockCommand-crash-fix.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Helvetica Volubi -Date: Thu, 24 Apr 2025 20:59:52 +0800 -Subject: [PATCH] SetBlockCommand crash fix - - -diff --git a/net/minecraft/server/commands/SetBlockCommand.java b/net/minecraft/server/commands/SetBlockCommand.java -index 05b824409546ba8bacf7efdaeac106af89ff0715..ad7306b42030844d735f42865d7aea3c4d42b01b 100644 ---- a/net/minecraft/server/commands/SetBlockCommand.java -+++ b/net/minecraft/server/commands/SetBlockCommand.java -@@ -119,6 +119,14 @@ public class SetBlockCommand { - // Folia start - region threading - } catch (CommandSyntaxException ex) { - sendMessage(source, ex); -+ // Luminol Start - Server crash fix -+ } catch (IllegalArgumentException iae) { -+ try { -+ throw ERROR_FAILED.create(); -+ } catch (CommandSyntaxException e) { -+ sendMessage(source, e); -+ } -+ // Luminol End - Server crash fix - } - }); - return 1;