Fix double space in MinecraftHelp page commands
This commit is contained in:
parent
0f4ad5d16a
commit
385453e1d5
1 changed files with 9 additions and 4 deletions
|
|
@ -600,16 +600,14 @@ public final class MinecraftHelp<C> {
|
||||||
return this.line(this.headerFooterLength);
|
return this.line(this.headerFooterLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String nextPageCommand = String.format("%s %s %s", this.commandPrefix, query, currentPage + 1);
|
final Component nextPageButton = this.button('→', this.pageCommand(query, currentPage + 1),
|
||||||
final Component nextPageButton = this.button('→', nextPageCommand,
|
|
||||||
this.messageProvider.provide(sender, MESSAGE_CLICK_FOR_NEXT_PAGE).color(this.colors.text)
|
this.messageProvider.provide(sender, MESSAGE_CLICK_FOR_NEXT_PAGE).color(this.colors.text)
|
||||||
);
|
);
|
||||||
if (firstPage) {
|
if (firstPage) {
|
||||||
return this.header(sender, nextPageButton);
|
return this.header(sender, nextPageButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String previousPageCommand = String.format("%s %s %s", this.commandPrefix, query, currentPage - 1);
|
final Component previousPageButton = this.button('←', this.pageCommand(query, currentPage - 1),
|
||||||
final Component previousPageButton = this.button('←', previousPageCommand,
|
|
||||||
this.messageProvider.provide(sender, MESSAGE_CLICK_FOR_PREVIOUS_PAGE).color(this.colors.text)
|
this.messageProvider.provide(sender, MESSAGE_CLICK_FOR_PREVIOUS_PAGE).color(this.colors.text)
|
||||||
);
|
);
|
||||||
if (lastPage) {
|
if (lastPage) {
|
||||||
|
|
@ -623,6 +621,13 @@ public final class MinecraftHelp<C> {
|
||||||
return this.header(sender, buttons);
|
return this.header(sender, buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String pageCommand(final String query, final int page) {
|
||||||
|
if (query.isEmpty()) {
|
||||||
|
return String.format("%s %s", this.commandPrefix, page);
|
||||||
|
}
|
||||||
|
return String.format("%s %s %s", this.commandPrefix, query, page);
|
||||||
|
}
|
||||||
|
|
||||||
private @NonNull Component header(
|
private @NonNull Component header(
|
||||||
final @NonNull C sender,
|
final @NonNull C sender,
|
||||||
final @NonNull Component title
|
final @NonNull Component title
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue