Solved Making a configurable gui?

Discussion in 'Spigot Plugin Development' started by pcrunn, Jun 1, 2018.

Thread Status:
Not open for further replies.
  1. Hello people, I'm trying to make a hub plugin and I'm in the part of the server selector. I need to make the server selector fully configurable and that so you can add as many items/servers you want on it. Any ideas?

    Thank You!
  2. Are you aiming for single or multipage?

    If single-page have a config with items with identifiers for which slot in f.ex the 54 slot gui.

    If multi-page, basically the same however multiple lists of items.
    • Like Like x 1
  3. I am aiming for a single page,But I don't think you understood what I mean. I want to make it so you can put as many items you want.
  4. Then do what he said, use a config of itemstacks. Just use List<ItemStack> and set and get that.
  5. when they put items in it have it so it just saves all items in the gui and then loads it when need-be
  6. Erm... weird way of answering the question @Above

    Anyway, I’d iterate through all the keys of the config. It’d have to be structured appropriately.
    Something like this could work:
    Code (Text):

      Title: ‘GUI’
      Size: 54
        Icon: COMPASS
    Obviously you could add support for lores, amounts, etc
  7. he wants people to be able to put anything they want in it, not change the items for the different things
  8. Heres how I would do it: create a command that opens a custom GUI where the player is gonna put the itsems with a Custom name, create another class that listens to the InvetoryCloseEvemt, check if the inventory just closed has your custom name, if yes loop through all the items and add them to a list that is going to be saved in a config. After, when they run your command just create a new inventory, get the list of items in the config, and with a foreach add those items to your inventory
  9. make a command to create an object named Item listed in the config and the user has to set the location for the item in the menu, the material, the name, etc

    Code (Text):
      item: itemstack
      position: 14
      name: pvp
      - go to pvp server
      command: server pvp
      item: itemstack
      position: 14
      name: survival
      - go to survival server
      command: server survival
    • Informative Informative x 1
  10. Thanks to everyone! I made it.
Thread Status:
Not open for further replies.