@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/server/CommandDispatcher.java
|
||||
+++ b/net/minecraft/server/CommandDispatcher.java
|
||||
@@ -19,12 +19,21 @@
|
||||
@@ -17,12 +17,21 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.google.common.base.Joiner;
|
||||
+import java.util.Collection;
|
||||
+import java.util.LinkedHashSet;
|
||||
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
||||
+import org.bukkit.event.player.PlayerCommandSendEvent;
|
||||
+import org.bukkit.event.server.ServerCommandEvent;
|
||||
+// CraftBukkit end
|
||||
@@ -17,30 +17,29 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> b = new com.mojang.brigadier.CommandDispatcher();
|
||||
|
||||
- public CommandDispatcher(boolean flag) {
|
||||
+ // CraftBukkit start
|
||||
+ public final CommandDispatcher init(boolean flag) {
|
||||
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype) {
|
||||
+ this(); // CraftBukkit
|
||||
CommandAdvancement.a(this.b);
|
||||
CommandAttribute.a(this.b);
|
||||
CommandExecute.a(this.b);
|
||||
CommandBossBar.a(this.b);
|
||||
@@ -100,14 +109,59 @@
|
||||
@@ -103,14 +112,57 @@
|
||||
}
|
||||
|
||||
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
|
||||
- CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection);
|
||||
+ // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection); // CraftBukkit
|
||||
});
|
||||
+ return this;
|
||||
- this.b.setConsumer((commandcontext, flag, i) -> {
|
||||
- ((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag, i);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public CommandDispatcher() {
|
||||
+ // CraftBukkit end
|
||||
this.b.setConsumer((commandcontext, flag1, i) -> {
|
||||
((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag1, i);
|
||||
+ this.b.setConsumer((commandcontext, flag1, i) -> {
|
||||
+ ((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag1, i);
|
||||
});
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public int dispatchServerCommand(CommandListenerWrapper sender, String command) {
|
||||
+ Joiner joiner = Joiner.on(" ");
|
||||
+ if (command.startsWith("/")) {
|
||||
@@ -84,16 +83,16 @@
|
||||
StringReader stringreader = new StringReader(s);
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -134,7 +188,7 @@
|
||||
@@ -137,7 +189,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatBaseComponent ichatbasecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).a((chatmodifier) -> {
|
||||
- chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s));
|
||||
+ chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
|
||||
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).format((chatmodifier) -> {
|
||||
- return chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s));
|
||||
+ return chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
|
||||
});
|
||||
|
||||
if (j > 10) {
|
||||
@@ -184,11 +238,36 @@
|
||||
@@ -187,11 +239,36 @@
|
||||
}
|
||||
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
@@ -131,7 +130,7 @@
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -199,7 +278,7 @@
|
||||
@@ -202,7 +279,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
@@ -140,7 +139,7 @@
|
||||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -222,7 +301,7 @@
|
||||
@@ -225,7 +302,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user