Removes spacing for letter search
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
This commit is contained in:
@@ -155,19 +155,19 @@ public final class BookFileHelper {
|
|||||||
int totalPages, @NotNull List<String> availableBooks,
|
int totalPages, @NotNull List<String> availableBooks,
|
||||||
@NotNull Map<Character, Integer> firstInstances) {
|
@NotNull Map<Character, Integer> firstInstances) {
|
||||||
ComponentBuilder headerComponent = new ComponentBuilder();
|
ComponentBuilder headerComponent = new ComponentBuilder();
|
||||||
headerComponent.append("Books page " + page + " of " + totalPages).color(ChatColor.GREEN);
|
headerComponent.append("Books page " + page + " of " + totalPages).color(ChatColor.GREEN).append(" ");
|
||||||
|
|
||||||
// Display links to first page where a letter can be found
|
// Display links to first page where a letter can be found
|
||||||
for (int characterIndex = 0; characterIndex <= 25; characterIndex++) {
|
for (int characterIndex = 0; characterIndex <= 25; characterIndex++) {
|
||||||
char character = (char) ('a' + characterIndex);
|
char character = (char) ('a' + characterIndex);
|
||||||
if (firstInstances.containsKey(character)) {
|
if (firstInstances.containsKey(character)) {
|
||||||
int pageIndex = (firstInstances.get(character) / booksPerPage) + 1;
|
int pageIndex = (firstInstances.get(character) / booksPerPage) + 1;
|
||||||
headerComponent.append(" ", ComponentBuilder.FormatRetention.NONE).append(character + "").color(
|
headerComponent.append(character + "").color(
|
||||||
ChatColor.AQUA).event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
ChatColor.AQUA).event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
||||||
"/" + command + " page" + pageIndex)).event(new HoverEvent(
|
"/" + command + " page" + pageIndex)).event(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT, new Text("To page " + pageIndex)));
|
HoverEvent.Action.SHOW_TEXT, new Text("To page " + pageIndex)));
|
||||||
} else {
|
} else {
|
||||||
headerComponent.append(" " + character, ComponentBuilder.FormatRetention.NONE).color(ChatColor.GRAY);
|
headerComponent.append(character + "", ComponentBuilder.FormatRetention.NONE).color(ChatColor.GRAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user