I cant seem to find this anywhere but how do i make a Page type system in the chat. I have an array that has a maximum of 5 Strings Before going to another page but idk how i would do something like that. Please Help Thanks Colink02
I think You can make a navigation button thing by a JSON Message but for the pages use this method and edit it as you like: Code (Text): /** * Sends the HELP as a paginated list of strings in chat to a player * * @param sender The sender to send the list to * @param list The list to paginate * @param page The page number to display. * @param countAll The count of all available entries */ public void paginate(CommandSender sender, ArrayList<String> list, int page, int countAll) { contentLinesPerPage = 5 int totalPageCount = 1; if((list.size() % contentLinesPerPage) == 0) { if(list.size() > 0) { totalPageCount = list.size() / contentLinesPerPage; } } else { totalPageCount = (list.size() / contentLinesPerPage) + 1; } if(page <= totalPageCount) { String paginatefirstline = String.valueOf(page) + "/" + String.valueOf(totalPageCount); sender.sendMessage(paginatefirstline); //beginline if(list.isEmpty()) { sender.sendMessage(ChatColor.WHITE + "The list is empty!"); } else { int i = 0, k = 0; page--; for (String entry : list) { k++; if ((((page * contentLinesPerPage) + i + 1) == k) && (k != ((page * contentLinesPerPage) + contentLinesPerPage + 1))) { i++; sender.sendMessage(entry); } } } //endline } else { sender.sendMessage(ChatColor.YELLOW + "There are only " + ChatColor.WHITE + totalPageCount + ChatColor.YELLOW + " pages!"); } }