Custom inventory resets on reload when it's open?

Discussion in 'Spigot Plugin Development' started by kinukin, Jun 5, 2017.

  1. When my custom inventory is opened then if I reload the server, it will wipe its contents.

    If the custom inventory is closed then the server reloads it doesn't wipe its contents. It shouldn't be wiping its contents when it's opened.

    Is this a bug?
     
  2. No, custom inventories don't have a holder, real chests in the game's contents are stored in the world folder. So, you have want to save it in a config file some where.
     
  3. Hmm I do have items stored inside a config. But when the server reloads and the inventory is opened it's contents are wiped. However if it is closed its saved and isn't wiped.
     
  4. That's because you haven't handled reload. You need to store the items and their places in the inventory somewhere. Such as a config. On enable, load the items back into the custom inventory.


    Sent from my iPhone using Tapatalk
     
  5. It still resets even if it is saved on onEnable and onDisable. Maybe it's a bug?

    When the server reloads the inventory resets even when it shouldn't be. Because I'm restoring it's contents back. The inventory is reset then it saves.
     
  6. reload is so bad for servers to begin with. I would suggest finding a way to store the data as stated and adding or using reload functions form the plugins you are using and not reloading the entire plugin list.
     
  7. I'm already restoring the data, regardless it stills reset.
     
  8. "reload is so bad for servers to begin with"

    I don't see any problem if you are using it in a development envirorment.