Skip to content

Commit

Permalink
Merge pull request #148 from RacoonDog/main
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Dec 14, 2023
2 parents 50752e4 + 890d1a0 commit 3416787
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 14 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()));
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)));
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 @@ -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();
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() + ">");
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));
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))));
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))));
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()));
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)));
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 @@ -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();
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() + ">");
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));
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))));
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))));
source.sendMessage(CommandMessageFormatting.error(new LiteralText(String.format("Usage: /%s %s", this.getCommandName(), usage.asUnformattedString()))));
}
}
} catch (Throwable t) {
Expand Down

0 comments on commit 3416787

Please sign in to comment.