use of pl.themolka.arcade.util.pagination.DynamicPagination in project Arcade2 by ShootGame.
the class MapCommands method mapList.
//
// /maplist command
//
@CommandInfo(name = { "maplist", "maps", "ml" }, description = "Show all loaded maps", usage = "[# page]", permission = "arcade.command.maplist")
public void mapList(Sender sender, CommandContext context) {
int paramPage = context.getParamInt(0, 1);
MapContainer container = this.plugin.getMaps().getContainer();
DynamicPagination pagination = new DynamicPagination.Builder().description(ChatColor.GOLD + "Next page: /" + context.getLabel() + " " + (paramPage + 1)).items(new ArrayList<>(container.getMaps())).title("Map List").build();
if (paramPage < 1 || paramPage > pagination.getPages()) {
throw new CommandException("Page #" + paramPage + " not found.");
}
pagination.display(sender, paramPage);
}
use of pl.themolka.arcade.util.pagination.DynamicPagination in project Arcade2 by ShootGame.
the class GameCommands method modules.
//
// /modules command
//
@CommandInfo(name = { "modulelist", "modules" }, description = "Show a list of modules available in this game", usage = "[# page]", permission = "arcade.command.modulelist")
public void modules(Sender sender, CommandContext context) {
int paramPage = context.getParamInt(0, 1);
Game game = this.plugin.getGames().getCurrentGame();
if (game == null) {
throw new CommandException("No game running right now.");
}
List<Paginationable> modules = new ArrayList<>(game.getModules().getModules());
if (modules.isEmpty()) {
throw new CommandException("No modules were installed in this map.");
}
DynamicPagination pagination = new DynamicPagination.Builder().description(ChatColor.GOLD + "Next page: /" + context.getLabel() + " " + (paramPage + 1)).items(modules).title("Module List").build();
if (paramPage < 1 || paramPage > pagination.getPages()) {
throw new CommandException("Page #" + paramPage + " not found.");
}
pagination.display(sender, paramPage);
}
Aggregations