public interface Pagination
isFirst() / isLast()).
you must start by setting the setIcons(Icon...) and the setIconsPerPage(int),
then you can manipulate the pages by using the
page(int) /
first() /
previous() /
next() /
last()
methods.
then, when you need to get all the icons of the current page,
either use the getPageIcons() method, or directly
add the icons to your inventory with a SlotIterator and the
method addToIterator(SlotIterator).
| Modifier and Type | Method and Description |
|---|---|
default @NotNull Pagination |
addToIterator(@NotNull SlotIterator iterator)
adds all the current page icons to the given iterator.
|
@NotNull Pagination |
first()
Sets the current page to the first page.
|
int |
getPage()
gets the current page.
|
@NotNull Icon[] |
getPageIcons()
gets the icons of the current page.
|
boolean |
isFirst()
checks if the current page is the first page.
|
boolean |
isLast()
checks if the current page is the last page.
|
@NotNull Pagination |
last()
sets the current page to the last page.
|
@NotNull Pagination |
next()
sets the current page to the next page,
if the current page is already the last page, this do nothing.
|
@NotNull Pagination |
page(int page)
sets the current page.
|
@NotNull Pagination |
previous()
sets the current page to the previous page,
if the current page is already the first page, this do nothing.
|
@NotNull Pagination |
setIcons(Icon... icons)
sets all the icons for this Pagination.
|
@NotNull Pagination |
setIconsPerPage(int iconsPerPage)
sets the maximum amount of icons per page.
|
@NotNull default @NotNull Pagination addToIterator(@NotNull @NotNull SlotIterator iterator)
iterator - the iterator.this, for chained calls.@NotNull @NotNull Icon[] getPageIcons()
this returns an array of the size of the icons per page.
int getPage()
@NotNull @NotNull Pagination page(int page)
page - the current page.this, for chained calls.boolean isFirst()
this is equivalent to: page == 0.
true if this page is the first page.boolean isLast()
this is equivalent to: page == iconsCount / iconsPerPage.
true if this page is the last page.@NotNull @NotNull Pagination first()
this is equivalent to: page(0).
this, for chained calls.@NotNull @NotNull Pagination previous()
this, for chained calls.@NotNull @NotNull Pagination next()
this, for chained calls.@NotNull @NotNull Pagination last()
this is equivalent to: page(iconsCount / iconsPerPage).
this, for chained calls.@NotNull @NotNull Pagination setIcons(@NotNull Icon... icons)
icons - the icons.this, for chained calls.@NotNull @NotNull Pagination setIconsPerPage(int iconsPerPage)
iconsPerPage - the maximum amount of icons per page.this, for chained calls.Copyright © 2021. All rights reserved.