Skip to content

Commit

Permalink
Fix more formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Nov 28, 2024
1 parent 9f8bb6e commit af26809
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public Text getUsage(PermissibleCommandSource src) {

if (usage.asUnformattedString().trim().length() > 0) {
builder.add(" ");
builder.add(usage);
builder.add(usage.asUnformattedString());
}

builder.add("]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ private PlayerEntity tryReturnSource(PermissibleCommandSource source, CommandArg

@Override
public Text getUsage(PermissibleCommandSource src) {
return src != null && this.returnSource ? new LiteralText("[" + super.getUsage(src) + "]") : super.getUsage(src);
return src != null && this.returnSource ? new LiteralText("[" + super.getUsage(src).asUnformattedString() + "]") : super.getUsage(src);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public Text getUsage(PermissibleCommandSource src) {

if (usage.asUnformattedString().trim().length() > 0) {
builder.add(" ");
builder.add(usage);
builder.add(usage.asUnformattedString());
}

builder.add("]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected Iterable<String> getChoices(PermissibleCommandSource source) {

@Override
protected Object getValue(String choice) throws IllegalArgumentException {
Optional<PlayerEntity> ret = this.getServer().getPlayerManager().players.stream().findFirst().map(Function.identity());
Optional<PlayerEntity> ret = this.getServer().getPlayerManager().players.stream().findFirst();

if (!ret.isPresent()) {
throw new IllegalArgumentException("Input value " + choice + " was not a player");
Expand All @@ -96,6 +96,6 @@ private PlayerEntity tryReturnSource(PermissibleCommandSource source, CommandArg

@Override
public Text getUsage(PermissibleCommandSource src) {
return src != null && this.returnSource ? new LiteralText("[" + super.getUsage(src) + "]") : super.getUsage(src);
return src != null && this.returnSource ? new LiteralText("[" + super.getUsage(src).asUnformattedString() + "]") : super.getUsage(src);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public Text getUsage(PermissibleCommandSource src) {

if (usage.asUnformattedString().trim().length() > 0) {
builder.add(" ");
builder.add(usage);
builder.add(usage.asUnformattedString());
}

builder.add("]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ private PlayerEntity tryReturnSource(PermissibleCommandSource source, CommandArg

@Override
public Text getUsage(PermissibleCommandSource src) {
return src != null && this.returnSource ? new LiteralText("[" + super.getUsage(src) + "]") : super.getUsage(src);
return src != null && this.returnSource ? new LiteralText("[" + super.getUsage(src).asUnformattedString() + "]") : super.getUsage(src);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public Object parseValue(PermissibleCommandSource source, CommandArgs args) thro

if (!ret.iterator().hasNext()) {
throw args.createError(new LiteralText(String.format("No values matching pattern '%s' present for %s!", arg, this.getKey() == null
? nullKeyArg : this.getKey())));
? nullKeyArg : this.getKey().asUnformattedString())));
}

return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void parse(PermissibleCommandSource source, CommandArgs args, CommandCont

if (context.getAll(this.element.getUntranslatedKey()).size() > 1) {
Text key = this.element.getKey();
throw args.createError(new LiteralText(String.format("Argument %s may have only one value!", key != null ? key : "unknown")));
throw args.createError(new LiteralText(String.format("Argument %s may have only one value!", key != null ? key.asUnformattedString() : "unknown")));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ public Text getUsage(PermissibleCommandSource src) {
return new LiteralText("");
}

return new LiteralText("[" + this.element.getUsage(src) + "]");
return new LiteralText("[" + this.element.getUsage(src).asUnformattedString() + "]");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private boolean checkPermission(PermissibleCommandSource source, CommandArgs arg

if (!hasPermission && !this.isOptional) {
Text key = this.getKey();
throw args.createError(new LiteralText(String.format("You do not have permission to use the %s argument", key != null ? key : "unknown")));
throw args.createError(new LiteralText(String.format("You do not have permission to use the %s argument", key != null ? key.asUnformattedString() : "unknown")));
}

return hasPermission;
Expand Down

0 comments on commit af26809

Please sign in to comment.