🎨 Show less useless info in MinecraftHelp
This commit is contained in:
parent
decde5cc77
commit
70818bb4b2
2 changed files with 83 additions and 81 deletions
|
|
@ -230,10 +230,8 @@ public final class MinecraftHelp<C> {
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final CommandHelpHandler.VerboseHelpEntry<C> entry = iterator.next();
|
final CommandHelpHandler.VerboseHelpEntry<C> entry = iterator.next();
|
||||||
|
|
||||||
final String description = entry.getDescription().isEmpty() ? this.messageProvider.apply(
|
final String description = entry.getDescription().isEmpty()
|
||||||
sender,
|
? this.messageProvider.apply(sender, MESSAGE_CLICK_TO_SHOW_HELP)
|
||||||
MESSAGE_CLICK_TO_SHOW_HELP
|
|
||||||
)
|
|
||||||
: entry.getDescription();
|
: entry.getDescription();
|
||||||
|
|
||||||
Component message = Component.text(" ")
|
Component message = Component.text(" ")
|
||||||
|
|
@ -291,15 +289,20 @@ public final class MinecraftHelp<C> {
|
||||||
))
|
))
|
||||||
.append(this.highlight(Component.text("/" + command, this.colors.highlight)))
|
.append(this.highlight(Component.text("/" + command, this.colors.highlight)))
|
||||||
);
|
);
|
||||||
|
final String topicDescription = helpTopic.getDescription().isEmpty()
|
||||||
|
? this.messageProvider.apply(sender, MESSAGE_NO_DESCRIPTION)
|
||||||
|
: helpTopic.getDescription();
|
||||||
|
final boolean hasArguments = helpTopic.getCommand().getArguments().size() > 1;
|
||||||
audience.sendMessage(
|
audience.sendMessage(
|
||||||
Component.text(" ")
|
Component.text(" ")
|
||||||
.append(this.branch())
|
.append(hasArguments ? this.branch() : this.lastBranch())
|
||||||
.append(Component.text(
|
.append(Component.text(
|
||||||
" " + this.messageProvider.apply(sender, MESSAGE_DESCRIPTION) + ": ",
|
" " + this.messageProvider.apply(sender, MESSAGE_DESCRIPTION) + ": ",
|
||||||
this.colors.primary
|
this.colors.primary
|
||||||
))
|
))
|
||||||
.append(Component.text(helpTopic.getDescription(), this.colors.text))
|
.append(Component.text(topicDescription, this.colors.text))
|
||||||
);
|
);
|
||||||
|
if (hasArguments) {
|
||||||
audience.sendMessage(
|
audience.sendMessage(
|
||||||
Component.text(" ")
|
Component.text(" ")
|
||||||
.append(this.lastBranch())
|
.append(this.lastBranch())
|
||||||
|
|
@ -316,11 +319,6 @@ public final class MinecraftHelp<C> {
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final CommandArgument<C, ?> argument = iterator.next();
|
final CommandArgument<C, ?> argument = iterator.next();
|
||||||
|
|
||||||
String description = helpTopic.getCommand().getArgumentDescription(argument);
|
|
||||||
if (description.isEmpty()) {
|
|
||||||
description = this.messageProvider.apply(sender, MESSAGE_NO_DESCRIPTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
String syntax = this.commandManager.getCommandSyntaxFormatter()
|
String syntax = this.commandManager.getCommandSyntaxFormatter()
|
||||||
.apply(Collections.singletonList(argument), null);
|
.apply(Collections.singletonList(argument), null);
|
||||||
|
|
||||||
|
|
@ -334,13 +332,17 @@ public final class MinecraftHelp<C> {
|
||||||
this.colors.alternateHighlight
|
this.colors.alternateHighlight
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
final String description = helpTopic.getCommand().getArgumentDescription(argument);
|
||||||
|
if (!description.isEmpty()) {
|
||||||
component
|
component
|
||||||
.append(Component.text(" - ", this.colors.accent))
|
.append(Component.text(" - ", this.colors.accent))
|
||||||
.append(Component.text(description, this.colors.text));
|
.append(Component.text(description, this.colors.text));
|
||||||
|
}
|
||||||
|
|
||||||
audience.sendMessage(component);
|
audience.sendMessage(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private @NonNull Component line(final int length) {
|
private @NonNull Component line(final int length) {
|
||||||
final TextComponent.Builder line = Component.text();
|
final TextComponent.Builder line = Component.text();
|
||||||
|
|
|
||||||
|
|
@ -305,8 +305,8 @@ public final class ExamplePlugin extends JavaPlugin {
|
||||||
//
|
//
|
||||||
// A command to change the color scheme for the help command
|
// A command to change the color scheme for the help command
|
||||||
//
|
//
|
||||||
manager.command(
|
manager.command(builder
|
||||||
manager.commandBuilder("example")
|
.meta("description", "Sets the color scheme for '/example help'")
|
||||||
.literal("helpcolors")
|
.literal("helpcolors")
|
||||||
.argument(
|
.argument(
|
||||||
manager.argumentBuilder(TextColor.class, "primary")
|
manager.argumentBuilder(TextColor.class, "primary")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue