Discussion in 'Spigot Plugin Development' started by DeliciousShoesHD, Mar 21, 2017.

  1. Yo geekers!

    Lately, I've been trying to complete my warp plugin, but I don't seem to be able to code pagination logic. If anyone could provide me with an example of code, it would be highly appreciated.

    Thanks in advance,
  2. Use a HashMap to pair specific pages with different sub-inventories which can be opened from the main inventory gui. After that is setup create the command to open the warp gui and make it open the main gui (which should be setup and stored onEnable). Store their UUID in a list of players who are current in the warp gui. When they close the inventory remove them from that list. For features of the gui, listen to the inventory click event, checking if they are in the warp gui by checking if their uuid is in the list you created early. Next identify if the item they click should redirect them to another gui (make sure their clicked inventory is the top inventory first) , and if it should, open the correct inventory from that HashMap (and make sure after u force them to open the new inventory you add them back to your list of UUIDs, since opening a new inventory using Player#openInventory causes the first inventory to launch an inventoryCloseEvent.
    • Useful Useful x 1
  3. Hey 7ory768, thanks for that! I will try to look into it. :)
    • Friendly Friendly x 1