Make registries Keyed.

This commit is contained in:
wizjany
2019-05-01 19:59:02 -04:00
parent 5781b4cd76
commit 5e81dd1c4c
18 changed files with 84 additions and 23 deletions

View File

@ -34,6 +34,7 @@ public abstract class PaginationBox extends MessageBox {
private String pageCommand;
private int componentsPerPage = IDEAL_ROWS_FOR_PLAYER;
private int currentPage = -1;
/**
* Creates a Paginated component
@ -57,6 +58,10 @@ public abstract class PaginationBox extends MessageBox {
this.componentsPerPage = 20;
}
protected final int getCurrentPage() {
return currentPage;
}
/**
* Creates a Paginated component
*
@ -80,6 +85,7 @@ public abstract class PaginationBox extends MessageBox {
if (page < 1 || page > pageCount) {
throw new InvalidComponentException("Invalid page number.");
}
currentPage = page;
final int lastComp = Math.min(page * componentsPerPage, getComponentsSize());
for (int i = (page - 1) * componentsPerPage; i < lastComp; i++) {
getContents().append(getComponent(i));