fix: only show [click for usages] when in game

This commit is contained in:
ChomeNS
2024-12-29 18:45:21 +07:00
parent 15ea941da7
commit d20f7532bf
2 changed files with 14 additions and 5 deletions

View File

@@ -1 +1 @@
1354
1355

View File

@@ -49,7 +49,7 @@ public class CommandContext {
if (required) {
throw new CommandException(
Component.translatable(
"Expected %s at position %s (%s %s) [%s]",
"Expected %s at position %s (%s %s)%s",
Component.text(type),
Component.text(argsPosition),
Component.text(prefix + userInputCommandName),
@@ -59,9 +59,18 @@ public class CommandContext {
.text(String.join(" ", args))
.append(Component.space())
.append(UNKNOWN_ARGUMENT_COMPONENT),
Component
.text("click for usages")
.clickEvent(ClickEvent.suggestCommand(prefix + "help " + this.commandName))
inGame ?
Component
.space()
.append(
Component.translatable("[%s]")
.arguments(
Component
.text("click for usages")
.clickEvent(ClickEvent.suggestCommand(prefix + "help " + this.commandName))
)
) :
Component.empty()
)
);
} else {