Skip to content

Commit

Permalink
use the right method for this
Browse files Browse the repository at this point in the history
  • Loading branch information
RacoonDog committed Sep 2, 2023
1 parent 8a8cc83 commit 890d1a0
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public Optional<Text> 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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()))));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() + ">");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public Optional<Text> 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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()))));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 890d1a0

Please sign in to comment.