mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-07 11:20:32 +01:00
Changed ITEMS_PER_PAGE to itemsPerPage since it's not a constant.
This commit is contained in:
parent
033df2f407
commit
90305a4379
@ -77,7 +77,7 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
|||||||
return;
|
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) {
|
if (filterObject.getPage() > totalPages) {
|
||||||
filterObject.setPage(totalPages);
|
filterObject.setPage(totalPages);
|
||||||
|
@ -89,7 +89,7 @@ public class HelpCommand extends PaginatedCoreCommand<Command> {
|
|||||||
return;
|
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) {
|
if (filterObject.getPage() > totalPages) {
|
||||||
filterObject.setPage(totalPages);
|
filterObject.setPage(totalPages);
|
||||||
|
@ -111,7 +111,7 @@ public class ListCommand extends PaginatedCoreCommand<String> {
|
|||||||
return;
|
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) {
|
if (filterObject.getPage() > totalPages) {
|
||||||
filterObject.setPage(totalPages);
|
filterObject.setPage(totalPages);
|
||||||
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||||||
* @author fernferret
|
* @author fernferret
|
||||||
*/
|
*/
|
||||||
public abstract class PaginatedCommand<T> extends Command {
|
public abstract class PaginatedCommand<T> extends Command {
|
||||||
protected int ITEMS_PER_PAGE = 9;
|
protected int itemsPerPage = 9;
|
||||||
|
|
||||||
|
|
||||||
public PaginatedCommand(JavaPlugin plugin) {
|
public PaginatedCommand(JavaPlugin plugin) {
|
||||||
@ -28,7 +28,7 @@ public abstract class PaginatedCommand<T> extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void setItemsPerPage(int items) {
|
protected void setItemsPerPage(int items) {
|
||||||
ITEMS_PER_PAGE = items;
|
itemsPerPage = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract List<T> getFilteredItems(List<T> availableItems, String filter);
|
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) {
|
protected void showPage(int page, CommandSender sender, List<T> cmds) {
|
||||||
// Ensure the page is at least 1.
|
// Ensure the page is at least 1.
|
||||||
page = (page <= 0) ? 1 : page;
|
page = (page <= 0) ? 1 : page;
|
||||||
int start = (page - 1) * ITEMS_PER_PAGE;
|
int start = (page - 1) * itemsPerPage;
|
||||||
int end = start + ITEMS_PER_PAGE;
|
int end = start + itemsPerPage;
|
||||||
|
|
||||||
for (int i = start; i < end; i++) {
|
for (int i = start; i < end; i++) {
|
||||||
// For consistancy, print some extra lines if it's a player:
|
// For consistancy, print some extra lines if it's a player:
|
||||||
|
Loading…
Reference in New Issue
Block a user