|
4 | 4 | import org.jetbrains.annotations.NotNull;
|
5 | 5 |
|
6 | 6 | /**
|
7 |
| - * GUI builder for creating a {@link PaginatedMenu} |
| 7 | + * Menu builder for creating a {@link PaginatedMenu} |
8 | 8 | */
|
9 | 9 | @SuppressWarnings("unused")
|
10 | 10 | public class PaginatedBuilder extends BaseBuilder<PaginatedMenu, PaginatedBuilder> {
|
11 |
| - |
12 |
| - private int pageSize = 0; |
| 11 | + private int pages = 2; |
13 | 12 |
|
14 | 13 | /**
|
15 |
| - * Sets the desirable page size, most of the time this isn't needed |
| 14 | + * Set the number of pages for the paginated builder. |
16 | 15 | *
|
17 |
| - * @param pageSize The amount of free slots that page items should occupy |
18 |
| - * @return The current builder |
| 16 | + * @param pages the number of pages to set |
| 17 | + * @return the builder for chaining |
19 | 18 | */
|
20 | 19 | @NotNull
|
21 | 20 | @Contract("_ -> this")
|
22 |
| - public PaginatedBuilder pageSize(final int pageSize) { |
23 |
| - this.pageSize = pageSize; |
| 21 | + public PaginatedBuilder pages(final int pages) { |
| 22 | + this.pages = pages; |
24 | 23 | return this;
|
25 | 24 | }
|
26 | 25 |
|
27 |
| - /** |
28 |
| - * Creates a new {@link PaginatedMenu} |
29 |
| - * |
30 |
| - * @return A new {@link PaginatedMenu} |
31 |
| - */ |
32 | 26 | @NotNull
|
33 | 27 | @Override
|
34 | 28 | @Contract(" -> new")
|
35 | 29 | public PaginatedMenu create() {
|
36 | 30 | checkRows(rows);
|
37 | 31 | final PaginatedMenu menu = type == MenuType.CHEST
|
38 |
| - ? new PaginatedMenu(rows, pageSize, title, modifiers) |
39 |
| - : new PaginatedMenu(type, pageSize, title, modifiers); |
40 |
| - if (menuConsumer != null) menuConsumer.accept(menu); |
| 32 | + ? new PaginatedMenu(rows, pages, title, modifiers) |
| 33 | + : new PaginatedMenu(type, pages, title, modifiers); |
| 34 | + menuConsumer.accept(menu); |
41 | 35 | return menu;
|
42 | 36 | }
|
43 | 37 | }
|
0 commit comments