mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-05 14:42:22 -07:00
port UnknownCommandEvent patch
This commit is contained in:
@@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||||
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||||
@@ -0,0 +0,0 @@ public class CommandSourceStack implements SharedSuggestionProvider {
|
@@ -0,0 +0,0 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendFailure(Component message) {
|
public void sendFailure(Component message) {
|
||||||
@@ -45,8 +45,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public class Commands {
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
b1 = 0;
|
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
||||||
return b1;
|
return "/" + s;
|
||||||
|
});
|
||||||
|
- ContextChain contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit
|
||||||
|
+ ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - make finishParsing not static
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (contextchain != null) {
|
||||||
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
- private static ContextChain<CommandSourceStack> finishParsing(ParseResults<CommandSourceStack> parseresults, String s, CommandSourceStack commandlistenerwrapper, String label) { // CraftBukkit
|
||||||
|
+ private ContextChain<CommandSourceStack> finishParsing(ParseResults<CommandSourceStack> parseresults, String s, CommandSourceStack commandlistenerwrapper, String label) { // CraftBukkit // Paper - make not static
|
||||||
|
try {
|
||||||
|
Commands.validateParseResults(parseresults);
|
||||||
|
return (ContextChain) ContextChain.tryFlatten(parseresults.getContext().build(s)).orElseThrow(() -> {
|
||||||
|
return CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherUnknownCommand().createWithContext(parseresults.getReader());
|
||||||
|
});
|
||||||
} catch (CommandSyntaxException commandsyntaxexception) {
|
} catch (CommandSyntaxException commandsyntaxexception) {
|
||||||
- commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage()));
|
- commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage()));
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
@@ -60,8 +77,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ builder.color(net.kyori.adventure.text.format.NamedTextColor.RED).append(io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(commandsyntaxexception.getRawMessage()));
|
+ builder.color(net.kyori.adventure.text.format.NamedTextColor.RED).append(io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(commandsyntaxexception.getRawMessage()));
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||||
MutableComponent ichatmutablecomponent = Component.empty().withStyle(ChatFormatting.GRAY).withStyle((chatmodifier) -> {
|
MutableComponent ichatmutablecomponent = Component.empty().withStyle(ChatFormatting.GRAY).withStyle((chatmodifier) -> {
|
||||||
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
|
ichatmutablecomponent.append(CommonComponents.ELLIPSIS);
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
ichatmutablecomponent.append(commandsyntaxexception.getInput().substring(Math.max(0, i - 10), i));
|
||||||
|
if (i < commandsyntaxexception.getInput().length()) {
|
||||||
|
MutableComponent ichatmutablecomponent1 = Component.literal(commandsyntaxexception.getInput().substring(i)).withStyle(ChatFormatting.RED, ChatFormatting.UNDERLINE);
|
||||||
@@ -0,0 +0,0 @@ public class Commands {
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
b1 = 0;
|
return null;
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
Reference in New Issue
Block a user