Skip to content

Commit 1c7d342

Browse files
1.4.0 pagination
1 parent de55764 commit 1c7d342

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/main/java/me/flame/menus/menu/PaginatedBuilder.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,34 @@
44
import org.jetbrains.annotations.NotNull;
55

66
/**
7-
* GUI builder for creating a {@link PaginatedMenu}
7+
* Menu builder for creating a {@link PaginatedMenu}
88
*/
99
@SuppressWarnings("unused")
1010
public class PaginatedBuilder extends BaseBuilder<PaginatedMenu, PaginatedBuilder> {
11-
12-
private int pageSize = 0;
11+
private int pages = 2;
1312

1413
/**
15-
* Sets the desirable page size, most of the time this isn't needed
14+
* Set the number of pages for the paginated builder.
1615
*
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
1918
*/
2019
@NotNull
2120
@Contract("_ -> this")
22-
public PaginatedBuilder pageSize(final int pageSize) {
23-
this.pageSize = pageSize;
21+
public PaginatedBuilder pages(final int pages) {
22+
this.pages = pages;
2423
return this;
2524
}
2625

27-
/**
28-
* Creates a new {@link PaginatedMenu}
29-
*
30-
* @return A new {@link PaginatedMenu}
31-
*/
3226
@NotNull
3327
@Override
3428
@Contract(" -> new")
3529
public PaginatedMenu create() {
3630
checkRows(rows);
3731
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);
4135
return menu;
4236
}
4337
}

0 commit comments

Comments
 (0)