Hello, I'm trying to make a paginated GUI with https://bukkit.org/threads/inventory-gui-pages.367576/. I've added the code, but when I try to run it, it gives an error: https://hastebin.com/tikizefune.bash When the player runs the command, they get added to the StoringMenuPageMap with the integer (page) 1. The plugin adds the items in the StoringMenuItems arraylist on startup. I'm using this code: Code: public static ArrayList<ItemStack> StoringMenuItems = new ArrayList<>(); public static HashMap<Player, Integer> StoringMenuPageMap = new HashMap<>(); int page = StoringMenuPageMap.get(p); int pagemin1 = page - 1; int pageplus1 = page + 1; int index = page * 45 - 45; int endIndex = index >= StoringMenuItems.size() ? StoringMenuItems.size() - 1 : index + 45; for (; index < endIndex; index++) { gui.setItem(index, StoringMenuItems.get(index)); } How do I fix this error? Kind regards, Stijn
I will indeed arrange the UUID support. int page = 1, int index = 0, int endindex = 45; -> When I've 1 item in the StoringMenuItems arraylist.
@stijnb1234 You are trying to get an iten from StoringMenuItems at index 1, endIndex should always be snaller or the same as StoringMenuItems.size()
@timtower Why is it so much better again to use UUIDs instead of Players? I dont see anything bad about it if you carefully remove references on specific events.
It's not fixed yet. There is a problem with Code: int endIndex = index >= StoringMenuItems.size() ? StoringMenuItems.size() - 1 : index + 45;