Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
SPIGOT-4026: Clicking on command error suggestion should return verbatim input
Dieser Commit ist enthalten in:
Ursprung
fa1340f7a6
Commit
b4bff6fc3d
@ -33,7 +33,7 @@
|
|||||||
this.b.setConsumer((commandcontext, flag, i) -> {
|
this.b.setConsumer((commandcontext, flag, i) -> {
|
||||||
((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag, i);
|
((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag, i);
|
||||||
});
|
});
|
||||||
@@ -114,7 +126,58 @@
|
@@ -114,8 +126,63 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +73,11 @@
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
public int a(CommandListenerWrapper commandlistenerwrapper, String s) {
|
public int a(CommandListenerWrapper commandlistenerwrapper, String s) {
|
||||||
|
- String s1 = s;
|
||||||
|
+ return this.a(commandlistenerwrapper, s, s);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int a(CommandListenerWrapper commandlistenerwrapper, String s, String label) {
|
||||||
+ // Some commands use the worldserver variable but we leave it full of null values,
|
+ // Some commands use the worldserver variable but we leave it full of null values,
|
||||||
+ // so we must temporarily populate it with the world of the commandsender
|
+ // so we must temporarily populate it with the world of the commandsender
|
||||||
+ WorldServer[] prev = MinecraftServer.getServer().worldServer;
|
+ WorldServer[] prev = MinecraftServer.getServer().worldServer;
|
||||||
@ -88,11 +93,12 @@
|
|||||||
+ }
|
+ }
|
||||||
+ server.worldServer[pos] = world;
|
+ server.worldServer[pos] = world;
|
||||||
+ }
|
+ }
|
||||||
|
+ String s1 = label;
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
String s1 = s;
|
|
||||||
|
|
||||||
if (s.startsWith("/")) {
|
if (s.startsWith("/")) {
|
||||||
@@ -126,7 +189,6 @@
|
s = s.substring(1);
|
||||||
|
@@ -126,7 +193,6 @@
|
||||||
byte b0;
|
byte b0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -100,7 +106,7 @@
|
|||||||
ChatComponentText chatcomponenttext;
|
ChatComponentText chatcomponenttext;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -135,54 +197,59 @@
|
@@ -135,54 +201,59 @@
|
||||||
return i;
|
return i;
|
||||||
} catch (CommandException commandexception) {
|
} catch (CommandException commandexception) {
|
||||||
commandlistenerwrapper.sendFailureMessage(commandexception.a());
|
commandlistenerwrapper.sendFailureMessage(commandexception.a());
|
||||||
@ -152,17 +158,17 @@
|
|||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
- chatcomponenttext = new ChatComponentText;
|
- chatcomponenttext = new ChatComponentText;
|
||||||
- }
|
- }
|
||||||
+ ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]);
|
-
|
||||||
|
|
||||||
- chatcomponenttext.<init>(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
|
- chatcomponenttext.<init>(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
|
||||||
- ChatComponentText chatcomponenttext1 = chatcomponenttext;
|
- ChatComponentText chatcomponenttext1 = chatcomponenttext;
|
||||||
|
+ ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]);
|
||||||
|
|
||||||
|
- if (CommandDispatcher.a.isDebugEnabled()) {
|
||||||
|
- StackTraceElement[] astacktraceelement = exception.getStackTrace();
|
||||||
+ chatcomponenttext = new ChatComponentText(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
|
+ chatcomponenttext = new ChatComponentText(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
|
||||||
+ if (CommandDispatcher.a.isDebugEnabled()) {
|
+ if (CommandDispatcher.a.isDebugEnabled()) {
|
||||||
+ StackTraceElement[] astacktraceelement = exception.getStackTrace();
|
+ StackTraceElement[] astacktraceelement = exception.getStackTrace();
|
||||||
|
|
||||||
- if (CommandDispatcher.a.isDebugEnabled()) {
|
|
||||||
- StackTraceElement[] astacktraceelement = exception.getStackTrace();
|
|
||||||
-
|
|
||||||
- for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
|
- for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
|
||||||
- chatcomponenttext1.a("\n\n").a(astacktraceelement[k].getMethodName()).a("\n ").a(astacktraceelement[k].getFileName()).a(":").a(String.valueOf(astacktraceelement[k].getLineNumber()));
|
- chatcomponenttext1.a("\n\n").a(astacktraceelement[k].getMethodName()).a("\n ").a(astacktraceelement[k].getFileName()).a(":").a(String.valueOf(astacktraceelement[k].getLineNumber()));
|
||||||
+ for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
|
+ for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
|
||||||
|
@ -43,7 +43,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));
|
dispatcher.a(icommandlistener, toDispatcher(args, getName()), toDispatcher(args, commandLabel));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public final class VanillaCommandWrapper extends BukkitCommand {
|
|||||||
Validate.notNull(alias, "Alias cannot be null");
|
Validate.notNull(alias, "Alias cannot be null");
|
||||||
|
|
||||||
CommandListenerWrapper icommandlistener = getListener(sender);
|
CommandListenerWrapper icommandlistener = getListener(sender);
|
||||||
ParseResults<CommandListenerWrapper> parsed = dispatcher.a().parse(toDispatcher(args), icommandlistener);
|
ParseResults<CommandListenerWrapper> parsed = dispatcher.a().parse(toDispatcher(args, getName()), icommandlistener);
|
||||||
|
|
||||||
List<String> results = new ArrayList<>();
|
List<String> results = new ArrayList<>();
|
||||||
dispatcher.a().getCompletionSuggestions(parsed).thenAccept((suggestions) -> {
|
dispatcher.a().getCompletionSuggestions(parsed).thenAccept((suggestions) -> {
|
||||||
@ -91,7 +91,7 @@ public final class VanillaCommandWrapper extends BukkitCommand {
|
|||||||
return "minecraft.command." + ((vanillaCommand.getRedirect() == null) ? vanillaCommand.getName() : vanillaCommand.getRedirect().getName());
|
return "minecraft.command." + ((vanillaCommand.getRedirect() == null) ? vanillaCommand.getName() : vanillaCommand.getRedirect().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toDispatcher(String[] args) {
|
private String toDispatcher(String[] args, String name) {
|
||||||
return getName() + ((args.length > 0) ? " " + Joiner.on(' ').join(args) : "");
|
return "/" + name + ((args.length > 0) ? " " + Joiner.on(' ').join(args) : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren