Changed ITEMS_PER_PAGE to itemsPerPage since it's not a constant.

This commit is contained in:
main() 2011-12-12 17:15:23 +01:00
parent 033df2f407
commit 90305a4379
4 changed files with 7 additions and 7 deletions

View File

@ -77,7 +77,7 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
return;
}
int totalPages = (int) Math.ceil(availableAnchors.size() / (this.ITEMS_PER_PAGE + 0.0));
int totalPages = (int) Math.ceil(availableAnchors.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);

View File

@ -89,7 +89,7 @@ public class HelpCommand extends PaginatedCoreCommand<Command> {
return;
}
int totalPages = (int) Math.ceil(availableCommands.size() / (this.ITEMS_PER_PAGE + 0.0));
int totalPages = (int) Math.ceil(availableCommands.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);

View File

@ -111,7 +111,7 @@ public class ListCommand extends PaginatedCoreCommand<String> {
return;
}
int totalPages = (int) Math.ceil(availableWorlds.size() / (this.ITEMS_PER_PAGE + 0.0));
int totalPages = (int) Math.ceil(availableWorlds.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);

View File

@ -20,7 +20,7 @@ import java.util.List;
* @author fernferret
*/
public abstract class PaginatedCommand<T> extends Command {
protected int ITEMS_PER_PAGE = 9;
protected int itemsPerPage = 9;
public PaginatedCommand(JavaPlugin plugin) {
@ -28,7 +28,7 @@ public abstract class PaginatedCommand<T> extends Command {
}
protected void setItemsPerPage(int items) {
ITEMS_PER_PAGE = items;
itemsPerPage = items;
}
protected abstract List<T> getFilteredItems(List<T> availableItems, String filter);
@ -44,8 +44,8 @@ public abstract class PaginatedCommand<T> extends Command {
protected void showPage(int page, CommandSender sender, List<T> cmds) {
// Ensure the page is at least 1.
page = (page <= 0) ? 1 : page;
int start = (page - 1) * ITEMS_PER_PAGE;
int end = start + ITEMS_PER_PAGE;
int start = (page - 1) * itemsPerPage;
int end = start + itemsPerPage;
for (int i = start; i < end; i++) {
// For consistancy, print some extra lines if it's a player: