From 3b7ad4bb6f11cd856edb7c524114ced33db6e044 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Thu, 27 Oct 2022 10:10:28 -0700 Subject: [PATCH] Make CommandSyntaxException implement ComponentMessageThrowable (#8513) --- .../Implement-Brigadier-Mojang-API.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/patches/server/Implement-Brigadier-Mojang-API.patch b/patches/server/Implement-Brigadier-Mojang-API.patch index 21964ba3e3..922c617314 100644 --- a/patches/server/Implement-Brigadier-Mojang-API.patch +++ b/patches/server/Implement-Brigadier-Mojang-API.patch @@ -21,6 +21,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("net.minecrell:terminalconsoleappender:1.3.0") +diff --git a/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java b/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java ++++ b/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java +@@ -0,0 +0,0 @@ package com.mojang.brigadier.exceptions; + + import com.mojang.brigadier.Message; + +-public class CommandSyntaxException extends Exception { ++public class CommandSyntaxException extends Exception implements net.kyori.adventure.util.ComponentMessageThrowable { // Paper + public static final int CONTEXT_AMOUNT = 10; + public static boolean ENABLE_COMMAND_STACK_TRACES = true; + public static BuiltInExceptionProvider BUILT_IN_EXCEPTIONS = new BuiltInExceptions(); +@@ -0,0 +0,0 @@ public class CommandSyntaxException extends Exception { + public int getCursor() { + return cursor; + } ++ ++ // Paper start ++ @Override ++ public @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component componentMessage() { ++ return io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(this.message); ++ } ++ // Paper end + } diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java