From 6f235068cf0161c6a0c004557314a7663a0c531f Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Fri, 28 Jul 2023 16:39:05 -0400 Subject: [PATCH 1/3] fix command error output --- .../v2/lib/sponge/args/ChildCommandElementExecutor.java | 4 ++-- .../fabric/api/command/v2/lib/sponge/args/CommandArgs.java | 2 +- .../fabric/api/command/v2/lib/sponge/args/CommandElement.java | 2 +- .../fabric/api/command/v2/lib/sponge/spec/CommandSpec.java | 2 +- .../legacyfabric/fabric/impl/command/CommandManagerImpl.java | 2 +- .../net/legacyfabric/fabric/impl/command/CommandWrapper.java | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java index 778da5d41..f3acf87a2 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java @@ -213,10 +213,10 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont if (ex instanceof ArgumentParseException.WithUsage) { // This indicates a previous child failed, so we just prepend our child - throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + ((ArgumentParseException.WithUsage) ex).getUsage())); + throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + ((ArgumentParseException.WithUsage) ex).getUsage().computeValue())); } - throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + mapping.getCallable().getUsage(source))); + throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + mapping.getCallable().getUsage(source).computeValue())); } } else { // Not a child, so let's continue with the fallback. diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandArgs.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandArgs.java index eac3ed9f0..bb598dcf0 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandArgs.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandArgs.java @@ -82,7 +82,7 @@ public boolean canComplete() { */ public String peek() throws ArgumentParseException { if (!this.hasNext()) { - throw this.createError(new LiteralText("Not enough arguments")); + throw this.createError(new LiteralText("Not enough arguments!")); } return this.args.get(this.index + 1).getValue(); diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java index 3c4fa7a37..75b940f8f 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java @@ -120,6 +120,6 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont * @return The formatted usage */ public Text getUsage(PermissibleCommandSource src) { - return this.getKey() == null ? new LiteralText("") : new LiteralText("<" + this.getKey() + ">"); + return this.getKey() == null ? new LiteralText("") : new LiteralText("<" + this.getKey().computeValue() + ">"); } } diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java index 977a768fc..b04af812c 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java @@ -449,7 +449,7 @@ public Optional getHelp(PermissibleCommandSource source) { Preconditions.checkNotNull(source, "source"); StringBuilder builder = new StringBuilder(); this.getShortDescription(source).ifPresent((a) -> builder.append(a.asUnformattedString()).append("\n")); - builder.append(this.getUsage(source)); + builder.append(this.getUsage(source).computeValue()); this.getExtendedDescription(source).ifPresent((a) -> builder.append(a.asUnformattedString()).append("\n")); return Optional.of(new LiteralText(builder.toString())); } diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java index aae1d7793..db846d96a 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java @@ -131,7 +131,7 @@ public CommandResult process(PermissibleCommandSource source, String command) { usage = mapping.get().getCallable().getUsage(source); } - source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", argSplit[0], usage)))); + source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", argSplit[0], usage.computeValue())))); } } } diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java index 4139e3455..958709626 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java @@ -89,7 +89,7 @@ public void execute(CommandSource source, String[] args) { usage = this.mapping.getCallable().getUsage((PermissibleCommandSource) source); } - source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage)))); + source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage.computeValue())))); } } } catch (Throwable t) { From 8a8cc8322d6f5f64936d8ec8615b7aab430104bc Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Fri, 28 Jul 2023 16:43:49 -0400 Subject: [PATCH 2/3] fix command error output (1.12.2) --- .../v2/lib/sponge/args/ChildCommandElementExecutor.java | 4 ++-- .../fabric/api/command/v2/lib/sponge/args/CommandArgs.java | 2 +- .../fabric/api/command/v2/lib/sponge/args/CommandElement.java | 2 +- .../fabric/api/command/v2/lib/sponge/spec/CommandSpec.java | 2 +- .../legacyfabric/fabric/impl/command/CommandManagerImpl.java | 2 +- .../net/legacyfabric/fabric/impl/command/CommandWrapper.java | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java index 778da5d41..f3acf87a2 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java @@ -213,10 +213,10 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont if (ex instanceof ArgumentParseException.WithUsage) { // This indicates a previous child failed, so we just prepend our child - throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + ((ArgumentParseException.WithUsage) ex).getUsage())); + throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + ((ArgumentParseException.WithUsage) ex).getUsage().computeValue())); } - throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + mapping.getCallable().getUsage(source))); + throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + mapping.getCallable().getUsage(source).computeValue())); } } else { // Not a child, so let's continue with the fallback. diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandArgs.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandArgs.java index eac3ed9f0..bb598dcf0 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandArgs.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandArgs.java @@ -82,7 +82,7 @@ public boolean canComplete() { */ public String peek() throws ArgumentParseException { if (!this.hasNext()) { - throw this.createError(new LiteralText("Not enough arguments")); + throw this.createError(new LiteralText("Not enough arguments!")); } return this.args.get(this.index + 1).getValue(); diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java index 5f738aae0..aa7185bee 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java @@ -125,7 +125,7 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont * @return The formatted usage */ public Text getUsage(PermissibleCommandSource src) { - return this.getKey() == null ? new LiteralText("") : new LiteralText("<" + this.getKey() + ">"); + return this.getKey() == null ? new LiteralText("") : new LiteralText("<" + this.getKey().computeValue() + ">"); } public MinecraftServer getServer() { diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java index 0ff22f668..39491e595 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java @@ -450,7 +450,7 @@ public Optional getHelp(PermissibleCommandSource source) { Preconditions.checkNotNull(source, "source"); StringBuilder builder = new StringBuilder(); this.getShortDescription(source).ifPresent((a) -> builder.append(a.asUnformattedString()).append("\n")); - builder.append(this.getUsage(source)); + builder.append(this.getUsage(source).computeValue()); this.getExtendedDescription(source).ifPresent((a) -> builder.append(a.asUnformattedString()).append("\n")); return Optional.of(new LiteralText(builder.toString())); } diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java index aae1d7793..db846d96a 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java @@ -131,7 +131,7 @@ public CommandResult process(PermissibleCommandSource source, String command) { usage = mapping.get().getCallable().getUsage(source); } - source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", argSplit[0], usage)))); + source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", argSplit[0], usage.computeValue())))); } } } diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java index a0fd49660..8999e7083 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java @@ -92,7 +92,7 @@ public void method_3279(MinecraftServer minecraftServer, CommandSource source, S usage = this.mapping.getCallable().getUsage((PermissibleCommandSource) source); } - source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage)))); + source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage.computeValue())))); } } } catch (Throwable t) { From 890d1a0ec6af014b3f22203a10bc0a07359f8c67 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Fri, 1 Sep 2023 23:35:23 -0400 Subject: [PATCH 3/3] use the right method for this --- .../v2/lib/sponge/args/ChildCommandElementExecutor.java | 4 ++-- .../fabric/api/command/v2/lib/sponge/args/CommandElement.java | 2 +- .../fabric/api/command/v2/lib/sponge/spec/CommandSpec.java | 2 +- .../legacyfabric/fabric/impl/command/CommandManagerImpl.java | 2 +- .../net/legacyfabric/fabric/impl/command/CommandWrapper.java | 2 +- .../v2/lib/sponge/args/ChildCommandElementExecutor.java | 4 ++-- .../fabric/api/command/v2/lib/sponge/args/CommandElement.java | 2 +- .../fabric/api/command/v2/lib/sponge/spec/CommandSpec.java | 2 +- .../legacyfabric/fabric/impl/command/CommandManagerImpl.java | 2 +- .../net/legacyfabric/fabric/impl/command/CommandWrapper.java | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java index f3acf87a2..5bffb66a0 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java @@ -213,10 +213,10 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont if (ex instanceof ArgumentParseException.WithUsage) { // This indicates a previous child failed, so we just prepend our child - throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + ((ArgumentParseException.WithUsage) ex).getUsage().computeValue())); + throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + ((ArgumentParseException.WithUsage) ex).getUsage().asUnformattedString())); } - throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + mapping.getCallable().getUsage(source).computeValue())); + throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + mapping.getCallable().getUsage(source).asUnformattedString())); } } else { // Not a child, so let's continue with the fallback. diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java index aa7185bee..e974c14d0 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java @@ -125,7 +125,7 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont * @return The formatted usage */ public Text getUsage(PermissibleCommandSource src) { - return this.getKey() == null ? new LiteralText("") : new LiteralText("<" + this.getKey().computeValue() + ">"); + return this.getKey() == null ? new LiteralText("") : new LiteralText("<" + this.getKey().asUnformattedString() + ">"); } public MinecraftServer getServer() { diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java index 39491e595..947f5a52f 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java @@ -450,7 +450,7 @@ public Optional getHelp(PermissibleCommandSource source) { Preconditions.checkNotNull(source, "source"); StringBuilder builder = new StringBuilder(); this.getShortDescription(source).ifPresent((a) -> builder.append(a.asUnformattedString()).append("\n")); - builder.append(this.getUsage(source).computeValue()); + builder.append(this.getUsage(source).asUnformattedString()); this.getExtendedDescription(source).ifPresent((a) -> builder.append(a.asUnformattedString()).append("\n")); return Optional.of(new LiteralText(builder.toString())); } diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java index db846d96a..154b79db9 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java @@ -131,7 +131,7 @@ public CommandResult process(PermissibleCommandSource source, String command) { usage = mapping.get().getCallable().getUsage(source); } - source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", argSplit[0], usage.computeValue())))); + source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", argSplit[0], usage.asUnformattedString())))); } } } diff --git a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java index 8999e7083..a16586a39 100644 --- a/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java +++ b/1.12.2/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java @@ -92,7 +92,7 @@ public void method_3279(MinecraftServer minecraftServer, CommandSource source, S usage = this.mapping.getCallable().getUsage((PermissibleCommandSource) source); } - source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage.computeValue())))); + source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage.asUnformattedString())))); } } } catch (Throwable t) { diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java index f3acf87a2..5bffb66a0 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/ChildCommandElementExecutor.java @@ -213,10 +213,10 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont if (ex instanceof ArgumentParseException.WithUsage) { // This indicates a previous child failed, so we just prepend our child - throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + ((ArgumentParseException.WithUsage) ex).getUsage().computeValue())); + throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + ((ArgumentParseException.WithUsage) ex).getUsage().asUnformattedString())); } - throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + mapping.getCallable().getUsage(source).computeValue())); + throw new ArgumentParseException.WithUsage(ex, new LiteralText(key + " " + mapping.getCallable().getUsage(source).asUnformattedString())); } } else { // Not a child, so let's continue with the fallback. diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java index 75b940f8f..2d1b16f6a 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/args/CommandElement.java @@ -120,6 +120,6 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont * @return The formatted usage */ public Text getUsage(PermissibleCommandSource src) { - return this.getKey() == null ? new LiteralText("") : new LiteralText("<" + this.getKey().computeValue() + ">"); + return this.getKey() == null ? new LiteralText("") : new LiteralText("<" + this.getKey().asUnformattedString() + ">"); } } diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java index b04af812c..1df183514 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/api/command/v2/lib/sponge/spec/CommandSpec.java @@ -449,7 +449,7 @@ public Optional getHelp(PermissibleCommandSource source) { Preconditions.checkNotNull(source, "source"); StringBuilder builder = new StringBuilder(); this.getShortDescription(source).ifPresent((a) -> builder.append(a.asUnformattedString()).append("\n")); - builder.append(this.getUsage(source).computeValue()); + builder.append(this.getUsage(source).asUnformattedString()); this.getExtendedDescription(source).ifPresent((a) -> builder.append(a.asUnformattedString()).append("\n")); return Optional.of(new LiteralText(builder.toString())); } diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java index db846d96a..154b79db9 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java @@ -131,7 +131,7 @@ public CommandResult process(PermissibleCommandSource source, String command) { usage = mapping.get().getCallable().getUsage(source); } - source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", argSplit[0], usage.computeValue())))); + source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", argSplit[0], usage.asUnformattedString())))); } } } diff --git a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java index 958709626..1a443abae 100644 --- a/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java +++ b/1.8.9/legacy-fabric-command-api-v2/src/main/java/net/legacyfabric/fabric/impl/command/CommandWrapper.java @@ -89,7 +89,7 @@ public void execute(CommandSource source, String[] args) { usage = this.mapping.getCallable().getUsage((PermissibleCommandSource) source); } - source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage.computeValue())))); + source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage.asUnformattedString())))); } } } catch (Throwable t) {