mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-02 05:02:10 -07:00
[ci skip] Add more patch identifying comments
This commit is contained in:
@@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
public void sendFailure(Component message) {
|
||||
+ // Paper start
|
||||
+ // Paper start - Add UnknownCommandEvent
|
||||
+ this.sendFailure(message, true);
|
||||
+ }
|
||||
+ public void sendFailure(Component message, boolean withStyle) {
|
||||
+ // Paper end
|
||||
+ // Paper end - Add UnknownCommandEvent
|
||||
if (this.source.acceptsFailure() && !this.silent) {
|
||||
- this.source.sendSystemMessage(Component.empty().append(message).withStyle(ChatFormatting.RED));
|
||||
+ this.source.sendSystemMessage(withStyle ? Component.empty().append(message).withStyle(ChatFormatting.RED) : message); // Paper
|
||||
+ this.source.sendSystemMessage(withStyle ? Component.empty().append(message).withStyle(ChatFormatting.RED) : message); // Paper - Add UnknownCommandEvent
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public static final int LEVEL_ADMINS = 3;
|
||||
public static final int LEVEL_OWNERS = 4;
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher = new com.mojang.brigadier.CommandDispatcher();
|
||||
+ public final java.util.List<CommandNode<CommandSourceStack>> vanillaCommandNodes = new java.util.ArrayList<>(); // Paper
|
||||
+ public final java.util.List<CommandNode<CommandSourceStack>> vanillaCommandNodes = new java.util.ArrayList<>(); // Paper - Add UnknownCommandEvent
|
||||
|
||||
public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) {
|
||||
this(); // CraftBukkit
|
||||
@@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (environment.includeIntegrated) {
|
||||
PublishCommand.register(this.dispatcher);
|
||||
}
|
||||
+ this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper
|
||||
+ this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper - Add UnknownCommandEvent
|
||||
|
||||
// CraftBukkit start
|
||||
}
|
||||
@@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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
|
||||
+ ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent
|
||||
|
||||
try {
|
||||
if (contextchain != null) {
|
||||
@@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@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
|
||||
+ private ContextChain<CommandSourceStack> finishParsing(ParseResults<CommandSourceStack> parseresults, String s, CommandSourceStack commandlistenerwrapper, String label) { // CraftBukkit // Paper - Add UnknownCommandEvent
|
||||
try {
|
||||
Commands.validateParseResults(parseresults);
|
||||
return (ContextChain) ContextChain.tryFlatten(parseresults.getContext().build(s)).orElseThrow(() -> {
|
||||
@@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
});
|
||||
} catch (CommandSyntaxException commandsyntaxexception) {
|
||||
- commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage()));
|
||||
+ // Paper start
|
||||
+ // Paper start - Add UnknownCommandEvent
|
||||
+ final net.kyori.adventure.text.TextComponent.Builder builder = net.kyori.adventure.text.Component.text();
|
||||
+ if ((parseresults.getContext().getNodes().isEmpty() || !this.vanillaCommandNodes.contains(parseresults.getContext().getNodes().get(0).getNode()))) {
|
||||
+ if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
|
||||
@@ -75,24 +75,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ } else {
|
||||
+ // commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage()));
|
||||
+ builder.color(net.kyori.adventure.text.format.NamedTextColor.RED).append(io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(commandsyntaxexception.getRawMessage()));
|
||||
+ // Paper end
|
||||
+ // Paper end - Add UnknownCommandEvent
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
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 {
|
||||
}
|
||||
|
||||
ichatmutablecomponent.append((Component) Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC));
|
||||
- commandlistenerwrapper.sendFailure(ichatmutablecomponent);
|
||||
+ // Paper start
|
||||
+ // Paper start - Add UnknownCommandEvent
|
||||
+ // commandlistenerwrapper.sendFailure(ichatmutablecomponent);
|
||||
+ builder
|
||||
+ .append(net.kyori.adventure.text.Component.newline())
|
||||
@@ -103,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.message() != null) {
|
||||
+ commandlistenerwrapper.sendFailure(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false);
|
||||
+ // Paper end
|
||||
+ // Paper end - Add UnknownCommandEvent
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user