mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 01:17:44 +01:00
Allow old behavior for CommandRegisteredEvent (#8249)
This commit is contained in:
parent
bef2c9d005
commit
a15152e96a
@ -5,5 +5,10 @@ import com.mojang.brigadier.suggestion.SuggestionProvider;
|
|||||||
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Brigadier {@link Command}, {@link SuggestionProvider}, and permission checker for Bukkit {@link Command}s.
|
||||||
|
*
|
||||||
|
* @param <S> command source type
|
||||||
|
*/
|
||||||
public interface BukkitBrigadierCommand <S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
|
public interface BukkitBrigadierCommand <S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
|
||||||
}
|
}
|
||||||
|
@ -13,18 +13,17 @@ import org.bukkit.event.server.ServerEvent;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fired anytime the server synchronizes Bukkit CommandMap to Brigadier.
|
* Fired anytime the server synchronizes Bukkit commands to Brigadier.
|
||||||
*
|
*
|
||||||
* Allows a plugin to control the Literal and Argument nodes for this command to be
|
* Allows a plugin to control the command node structure for its commands.
|
||||||
* sent to the client.
|
* This is done at Plugin Enable time after commands have been registered, but may also
|
||||||
* This is done at Plugin Enable time after commands have been registered, but some
|
* run at a later point in the server lifetime due to plugins, a server reload, etc.
|
||||||
* plugins may use reflection to retrigger this rebuild during runtime.
|
|
||||||
*
|
*
|
||||||
* @deprecated Draft API - Subject to change until confirmed solves desired use cases
|
* @deprecated Draft API - Subject to change until confirmed solves desired use cases
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Warning(false)
|
@Warning(false)
|
||||||
public class CommandRegisteredEvent <S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
|
public class CommandRegisteredEvent<S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final String commandLabel;
|
private final String commandLabel;
|
||||||
@ -33,6 +32,7 @@ public class CommandRegisteredEvent <S extends BukkitBrigadierCommandSource> ext
|
|||||||
private final RootCommandNode<S> root;
|
private final RootCommandNode<S> root;
|
||||||
private final ArgumentCommandNode<S, String> defaultArgs;
|
private final ArgumentCommandNode<S, String> defaultArgs;
|
||||||
private LiteralCommandNode<S> literal;
|
private LiteralCommandNode<S> literal;
|
||||||
|
private boolean rawCommand = false;
|
||||||
private boolean cancelled = false;
|
private boolean cancelled = false;
|
||||||
|
|
||||||
public CommandRegisteredEvent(String commandLabel, BukkitBrigadierCommand<S> brigadierCommand, Command command, RootCommandNode<S> root, LiteralCommandNode<S> literal, ArgumentCommandNode<S, String> defaultArgs) {
|
public CommandRegisteredEvent(String commandLabel, BukkitBrigadierCommand<S> brigadierCommand, Command command, RootCommandNode<S> root, LiteralCommandNode<S> literal, ArgumentCommandNode<S, String> defaultArgs) {
|
||||||
@ -45,55 +45,99 @@ public class CommandRegisteredEvent <S extends BukkitBrigadierCommandSource> ext
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The command name being registered
|
* Gets the command label of the {@link Command} being registered.
|
||||||
|
*
|
||||||
|
* @return the command label
|
||||||
*/
|
*/
|
||||||
public String getCommandLabel() {
|
public String getCommandLabel() {
|
||||||
return commandLabel;
|
return this.commandLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The Bukkit API Brigadier Wrapped Command Object to handle executions and suggestions
|
* Gets the {@link BukkitBrigadierCommand} for the {@link Command} being registered. This can be used
|
||||||
|
* as the {@link com.mojang.brigadier.Command command executor} or
|
||||||
|
* {@link com.mojang.brigadier.suggestion.SuggestionProvider} of a {@link com.mojang.brigadier.tree.CommandNode}
|
||||||
|
* to delegate to the {@link Command} being registered.
|
||||||
|
*
|
||||||
|
* @return the {@link BukkitBrigadierCommand}
|
||||||
*/
|
*/
|
||||||
public BukkitBrigadierCommand<S> getBrigadierCommand() {
|
public BukkitBrigadierCommand<S> getBrigadierCommand() {
|
||||||
return brigadierCommand;
|
return this.brigadierCommand;
|
||||||
}
|
|
||||||
|
|
||||||
public Command getCommand() {
|
|
||||||
return command;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Gets the root command node being used to register a command to.
|
* Gets the {@link Command} being registered.
|
||||||
|
*
|
||||||
|
* @return the {@link Command}
|
||||||
|
*/
|
||||||
|
public Command getCommand() {
|
||||||
|
return this.command;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link RootCommandNode} which is being registered to.
|
||||||
|
*
|
||||||
|
* @return the {@link RootCommandNode}
|
||||||
*/
|
*/
|
||||||
public RootCommandNode<S> getRoot() {
|
public RootCommandNode<S> getRoot() {
|
||||||
return root;
|
return this.root;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Bukkit API's default handling of Arguments, if you wish to reuse it.
|
* Gets the Bukkit APIs default arguments node (greedy string), for if
|
||||||
* @return
|
* you wish to reuse it.
|
||||||
|
*
|
||||||
|
* @return default arguments node
|
||||||
*/
|
*/
|
||||||
public ArgumentCommandNode<S, String> getDefaultArgs() {
|
public ArgumentCommandNode<S, String> getDefaultArgs() {
|
||||||
return defaultArgs;
|
return this.defaultArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Bukkit API's default literal for this command, including the {@link #getDefaultArgs()} as a child already.
|
* Gets the {@link LiteralCommandNode} to be registered for the {@link Command}.
|
||||||
* @return
|
*
|
||||||
|
* @return the {@link LiteralCommandNode}
|
||||||
*/
|
*/
|
||||||
public LiteralCommandNode<S> getLiteral() {
|
public LiteralCommandNode<S> getLiteral() {
|
||||||
return literal;
|
return this.literal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the literal used to register this command. The previous literable is mutable, so this is primarily if
|
* Sets the {@link LiteralCommandNode} used to register this command. The default literal is mutable, so
|
||||||
* you want to completely replace the object.
|
* this is primarily if you want to completely replace the object.
|
||||||
* @param literal
|
*
|
||||||
|
* @param literal new node
|
||||||
*/
|
*/
|
||||||
public void setLiteral(LiteralCommandNode<S> literal) {
|
public void setLiteral(LiteralCommandNode<S> literal) {
|
||||||
this.literal = literal;
|
this.literal = literal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether this command should is treated as "raw".
|
||||||
|
*
|
||||||
|
* @see #setRawCommand(boolean)
|
||||||
|
* @return whether this command is treated as "raw"
|
||||||
|
*/
|
||||||
|
public boolean isRawCommand() {
|
||||||
|
return this.rawCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this command should be treated as "raw".
|
||||||
|
*
|
||||||
|
* <p>A "raw" command will only use the node provided by this event for
|
||||||
|
* sending the command tree to the client. For execution purposes, the default
|
||||||
|
* greedy string execution of a standard Bukkit {@link Command} is used.</p>
|
||||||
|
*
|
||||||
|
* <p>On older versions of Paper, this was the default and only behavior of this
|
||||||
|
* event.</p>
|
||||||
|
*
|
||||||
|
* @param rawCommand whether this command should be treated as "raw"
|
||||||
|
*/
|
||||||
|
public void setRawCommand(final boolean rawCommand) {
|
||||||
|
this.rawCommand = rawCommand;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +21,18 @@ index 6dbac0f93481256dd57e76630ae9eea9d5c56849..e260462933a9f7065b2360e6bf9e4ee5
|
|||||||
// Paper start
|
// Paper start
|
||||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||||
|
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
|
index da6250df1c5f3385b683cffde47754bca4606f5e..3384501f83d445f45aa8233e98c7597daa67b8ef 100644
|
||||||
|
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
|
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
|
@@ -34,6 +34,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
||||||
|
private final RedirectModifier<S> modifier;
|
||||||
|
private final boolean forks;
|
||||||
|
private Command<S> command;
|
||||||
|
+ public LiteralCommandNode<CommandSourceStack> clientNode = null; // Paper
|
||||||
|
// CraftBukkit start
|
||||||
|
public void removeCommand(String name) {
|
||||||
|
this.children.remove(name);
|
||||||
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||||
index a749ea8578fc8baeebd359e0275f1c3089beec13..981f08a537253516a6ce8b78f6cd04d7e5e1b546 100644
|
index a749ea8578fc8baeebd359e0275f1c3089beec13..981f08a537253516a6ce8b78f6cd04d7e5e1b546 100644
|
||||||
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||||
@ -62,7 +74,7 @@ index a749ea8578fc8baeebd359e0275f1c3089beec13..981f08a537253516a6ce8b78f6cd04d7
|
|||||||
public boolean hasPermission(int level) {
|
public boolean hasPermission(int level) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||||
index 685e04b1f17938d49cd126bcfe2f488f21afbea2..54bf5558c9048c215aee518874f3d96ab473beb6 100644
|
index 685e04b1f17938d49cd126bcfe2f488f21afbea2..d4e3dc8d67006dcff2a64d03c29ffc9414557017 100644
|
||||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||||
@@ -385,6 +385,7 @@ public class Commands {
|
@@ -385,6 +385,7 @@ public class Commands {
|
||||||
@ -81,8 +93,20 @@ index 685e04b1f17938d49cd126bcfe2f488f21afbea2..54bf5558c9048c215aee518874f3d96a
|
|||||||
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
||||||
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
@@ -410,6 +412,11 @@ public class Commands {
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
||||||
|
+ // Paper start
|
||||||
|
+ if (commandnode2.clientNode != null) {
|
||||||
|
+ commandnode2 = commandnode2.clientNode;
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
if ( !org.spigotmc.SpigotConfig.sendNamespaced && commandnode2.getName().contains( ":" ) ) continue; // Spigot
|
||||||
|
|
||||||
|
if (commandnode2.canUse(source)) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 88f58eeaf2566bdee2f6e44ddc1187f762345347..a033040751583270c9883652b2acb30c0d100e68 100644
|
index c60baac35e4ae333971532ad2da6dd0925efc1a9..4f9adc601ccc84beaee91a6ca9d6cd2740c4416e 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -833,8 +833,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -833,8 +833,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
@ -116,7 +140,7 @@ index 88f58eeaf2566bdee2f6e44ddc1187f762345347..a033040751583270c9883652b2acb30c
|
|||||||
});
|
});
|
||||||
// Paper end - async tab completion
|
// Paper end - async tab completion
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
||||||
index 83d81b9371902b0302d13e53b31c15fac4e67966..9e4a660bdeaa70536bd8aeb90aa4a6a979f3f061 100644
|
index 83d81b9371902b0302d13e53b31c15fac4e67966..d113e54a30db16e2ad955170df6030d15de530d6 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
--- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
||||||
@@ -20,7 +20,7 @@ import org.bukkit.command.CommandException;
|
@@ -20,7 +20,7 @@ import org.bukkit.command.CommandException;
|
||||||
@ -128,7 +152,7 @@ index 83d81b9371902b0302d13e53b31c15fac4e67966..9e4a660bdeaa70536bd8aeb90aa4a6a9
|
|||||||
|
|
||||||
private final CraftServer server;
|
private final CraftServer server;
|
||||||
private final Command command;
|
private final Command command;
|
||||||
@@ -31,10 +31,19 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command<Comman
|
@@ -31,10 +31,24 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command<Comman
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiteralCommandNode<CommandSourceStack> register(CommandDispatcher<CommandSourceStack> dispatcher, String label) {
|
public LiteralCommandNode<CommandSourceStack> register(CommandDispatcher<CommandSourceStack> dispatcher, String label) {
|
||||||
@ -139,6 +163,7 @@ index 83d81b9371902b0302d13e53b31c15fac4e67966..9e4a660bdeaa70536bd8aeb90aa4a6a9
|
|||||||
+ // Paper start - Expose Brigadier to Paper-MojangAPI
|
+ // Paper start - Expose Brigadier to Paper-MojangAPI
|
||||||
+ com.mojang.brigadier.tree.RootCommandNode<CommandSourceStack> root = dispatcher.getRoot();
|
+ com.mojang.brigadier.tree.RootCommandNode<CommandSourceStack> root = dispatcher.getRoot();
|
||||||
+ LiteralCommandNode<CommandSourceStack> literal = LiteralArgumentBuilder.<CommandSourceStack>literal(label).requires(this).executes(this).build();
|
+ LiteralCommandNode<CommandSourceStack> literal = LiteralArgumentBuilder.<CommandSourceStack>literal(label).requires(this).executes(this).build();
|
||||||
|
+ LiteralCommandNode<CommandSourceStack> defaultNode = literal;
|
||||||
+ com.mojang.brigadier.tree.ArgumentCommandNode<CommandSourceStack, String> defaultArgs = RequiredArgumentBuilder.<CommandSourceStack, String>argument("args", StringArgumentType.greedyString()).suggests(this).executes(this).build();
|
+ com.mojang.brigadier.tree.ArgumentCommandNode<CommandSourceStack, String> defaultArgs = RequiredArgumentBuilder.<CommandSourceStack, String>argument("args", StringArgumentType.greedyString()).suggests(this).executes(this).build();
|
||||||
+ literal.addChild(defaultArgs);
|
+ literal.addChild(defaultArgs);
|
||||||
+ com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent<CommandSourceStack> event = new com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent<>(label, this, this.command, root, literal, defaultArgs);
|
+ com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent<CommandSourceStack> event = new com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent<>(label, this, this.command, root, literal, defaultArgs);
|
||||||
@ -146,6 +171,10 @@ index 83d81b9371902b0302d13e53b31c15fac4e67966..9e4a660bdeaa70536bd8aeb90aa4a6a9
|
|||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+ literal = event.getLiteral();
|
+ literal = event.getLiteral();
|
||||||
|
+ if (event.isRawCommand()) {
|
||||||
|
+ defaultNode.clientNode = literal;
|
||||||
|
+ literal = defaultNode;
|
||||||
|
+ }
|
||||||
+ root.addChild(literal);
|
+ root.addChild(literal);
|
||||||
+ return literal;
|
+ return literal;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Optimize brigadier child sorting performance
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
index da6250df1c5f3385b683cffde47754bca4606f5e..a4f97c1df86c574af9b9824a38034a3d76d6e357 100644
|
index 3384501f83d445f45aa8233e98c7597daa67b8ef..20a7cdf87f307878d66922aaac0c60cff218e46c 100644
|
||||||
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
@@ -26,7 +26,7 @@ import java.util.function.Predicate;
|
@@ -26,7 +26,7 @@ import java.util.function.Predicate;
|
||||||
@ -17,7 +17,7 @@ index da6250df1c5f3385b683cffde47754bca4606f5e..a4f97c1df86c574af9b9824a38034a3d
|
|||||||
private final Map<String, LiteralCommandNode<S>> literals = new LinkedHashMap<>();
|
private final Map<String, LiteralCommandNode<S>> literals = new LinkedHashMap<>();
|
||||||
private final Map<String, ArgumentCommandNode<S, ?>> arguments = new LinkedHashMap<>();
|
private final Map<String, ArgumentCommandNode<S, ?>> arguments = new LinkedHashMap<>();
|
||||||
public Predicate<S> requirement;
|
public Predicate<S> requirement;
|
||||||
@@ -106,6 +106,8 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
@@ -107,6 +107,8 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
||||||
this.arguments.put(node.getName(), (ArgumentCommandNode<S, ?>) node);
|
this.arguments.put(node.getName(), (ArgumentCommandNode<S, ?>) node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@ to race conditions.
|
|||||||
Plus, .canUse we want to be safe for async anyways.
|
Plus, .canUse we want to be safe for async anyways.
|
||||||
|
|
||||||
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
index a4f97c1df86c574af9b9824a38034a3d76d6e357..d65defd5fc54086a969c568b93dfb05f40dd5a44 100644
|
index 20a7cdf87f307878d66922aaac0c60cff218e46c..39844531b03eb8a6c70700b4ecbf0ff1a557424d 100644
|
||||||
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
@@ -74,10 +74,10 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
@@ -75,10 +75,10 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
||||||
public synchronized boolean canUse(final S source) {
|
public synchronized boolean canUse(final S source) {
|
||||||
if (source instanceof CommandSourceStack) {
|
if (source instanceof CommandSourceStack) {
|
||||||
try {
|
try {
|
||||||
|
@ -112,10 +112,10 @@ index 831db5ee21938d71e99bf9d17b92a6ca15531740..def4fdd2c7e4f925fa128692a744e5d1
|
|||||||
|
|
||||||
public DyeColor getColor() {
|
public DyeColor getColor() {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
||||||
index 9e4a660bdeaa70536bd8aeb90aa4a6a979f3f061..2476727cd60034c4df2db36b9ed808e72d7b686f 100644
|
index d113e54a30db16e2ad955170df6030d15de530d6..26f3a2799e687731d883e7733591f6934479e88d 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
--- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
|
||||||
@@ -56,7 +56,7 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command<Comman
|
@@ -61,7 +61,7 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command<Comman
|
||||||
CommandSender sender = context.getSource().getBukkitSender();
|
CommandSender sender = context.getSource().getBukkitSender();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -35,7 +35,7 @@ index b14773074fc4b10ef427eb0ad9e21601a7287901..e0dd0fc1638377f4d4226d4b2976b901
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||||
index e70e5af7e49e4ccf332d9ce44e1a106344b35490..a0f5aa8c3cfce63af9cb286278a7fdebd7aa3642 100644
|
index 8380ab300e192064735fcb54c61951522dec8511..e998b01faa9c1d2e5f0fd91f0afdb24d56e03712 100644
|
||||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||||
@@ -422,6 +422,7 @@ public class Commands {
|
@@ -422,6 +422,7 @@ public class Commands {
|
||||||
@ -45,8 +45,8 @@ index e70e5af7e49e4ccf332d9ce44e1a106344b35490..a0f5aa8c3cfce63af9cb286278a7fdeb
|
|||||||
+ boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments
|
+ boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
||||||
if ( !org.spigotmc.SpigotConfig.sendNamespaced && commandnode2.getName().contains( ":" ) ) continue; // Spigot
|
// Paper start
|
||||||
@@ -443,6 +444,12 @@ public class Commands {
|
@@ -448,6 +449,12 @@ public class Commands {
|
||||||
|
|
||||||
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
|
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
|
||||||
requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));
|
requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));
|
||||||
|
Loading…
Reference in New Issue
Block a user