Solved Infinite Pages

Discussion in 'Spigot Plugin Development' started by iTouchedTrump, Jun 27, 2016.

  1. Hello,

    I am creating a plugin that requires me to use a GUI, but with this GUI I might need multiple pages. Lets just say I was creating a plugin that adds all the configuration options into a GUI. So I would use
    Code (Text):
    and some for loops before this, but I know that inv#addItem returns a Map<Integer, ItemStack>, but, how could I make this have infinite pages. Without just copying and pasting a lot of code... (I have googled multiple times, and been trying different methods for a while also.)

    Thanks in advance,
    Jake B.
  2. Code (Java):
    if (get size - 1 item is not null) {
      add the option
    if(the option clicked) {
      get current page (int)
      add + 1 to int
      create inventory with name "Page " + page;
    • Winner Winner x 1
  3. @MadMaxCookie ahh, thanks :) I thought I would have to use the return of the inv#addItem

    EDIT - I meant what inv#addItem returns haha, I guess I phrased it wrong
    #3 iTouchedTrump, Jun 27, 2016
    Last edited: Jun 27, 2016
  4. yes depends on a method but still prefer to what I've said above if you don't know the method to use to what you're implying for about "return"
  5. First of all, you'll need amount of buttons.
    Static buttons are always there. Make that amount final.
    Add them to the spots.
    Next, empty space? Add that to the final amount.
    Next and prev page.
    If it's page 1, add a next page if amount of items max-added-finalvalue < 0
    Find empty spots where items can go in total, and how many different slots they'll take.
    Howmany-emptyslots & at the same time increase amount of pages.

    At last you have all your pages, with the last one having from 1 item to max. Fill them.

    Use a map to store current page.