#816: Prevent duplicate slash removal for console / block commands
This commit is contained in:
parent
5b0e2d2d60
commit
1e8c432cd9
@ -22,7 +22,7 @@
|
|||||||
CommandAdvancement.a(this.b);
|
CommandAdvancement.a(this.b);
|
||||||
CommandAttribute.a(this.b);
|
CommandAttribute.a(this.b);
|
||||||
CommandExecute.a(this.b);
|
CommandExecute.a(this.b);
|
||||||
@@ -188,14 +197,57 @@
|
@@ -188,17 +197,61 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
|
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
|
||||||
@ -71,19 +71,24 @@
|
|||||||
+ args[0] = "minecraft:" + args[0];
|
+ args[0] = "minecraft:" + args[0];
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return this.a(sender, joiner.join(args));
|
+ String newCommand = joiner.join(args);
|
||||||
|
+ return this.a(sender, newCommand, newCommand, false);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
public int a(CommandListenerWrapper commandlistenerwrapper, String s) {
|
public int a(CommandListenerWrapper commandlistenerwrapper, String s) {
|
||||||
+ return this.a(commandlistenerwrapper, s, s);
|
+ return this.a(commandlistenerwrapper, s, s, true);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public int a(CommandListenerWrapper commandlistenerwrapper, String s, String label) {
|
+ public int a(CommandListenerWrapper commandlistenerwrapper, String s, String label, boolean stripSlash) {
|
||||||
+ // CraftBukkit end
|
|
||||||
StringReader stringreader = new StringReader(s);
|
StringReader stringreader = new StringReader(s);
|
||||||
|
|
||||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
- if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||||
@@ -222,7 +274,7 @@
|
+ if (stripSlash && stringreader.canRead() && stringreader.peek() == '/') {
|
||||||
|
+ // CraftBukkit end
|
||||||
|
stringreader.skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -222,7 +275,7 @@
|
||||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||||
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).format((chatmodifier) -> {
|
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).format((chatmodifier) -> {
|
||||||
@ -92,7 +97,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (j > 10) {
|
if (j > 10) {
|
||||||
@@ -272,11 +324,36 @@
|
@@ -272,11 +325,36 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(EntityPlayer entityplayer) {
|
public void a(EntityPlayer entityplayer) {
|
||||||
@ -130,7 +135,7 @@
|
|||||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +364,7 @@
|
@@ -287,7 +365,7 @@
|
||||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||||
|
|
||||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||||
@ -139,7 +144,7 @@
|
|||||||
|
|
||||||
argumentbuilder.requires((icompletionprovider) -> {
|
argumentbuilder.requires((icompletionprovider) -> {
|
||||||
return true;
|
return true;
|
||||||
@@ -310,7 +387,7 @@
|
@@ -310,7 +388,7 @@
|
||||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public final class VanillaCommandWrapper extends BukkitCommand {
|
|||||||
if (!testPermission(sender)) return true;
|
if (!testPermission(sender)) return true;
|
||||||
|
|
||||||
CommandListenerWrapper icommandlistener = getListener(sender);
|
CommandListenerWrapper icommandlistener = getListener(sender);
|
||||||
dispatcher.a(icommandlistener, toDispatcher(args, getName()), toDispatcher(args, commandLabel));
|
dispatcher.a(icommandlistener, toDispatcher(args, getName()), toDispatcher(args, commandLabel), true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user