Is this taking space

Discussion in 'Spigot Plugin Development' started by Ean244, Jun 6, 2017.

  1. Hi. im creating a plugin that has a gui, the items in it can be edited in config.So i made a class that stores all the items in it.The items has identifiers public static final, i have like,40 itemstacks, will this affect the server's performance?If yes, how should I fix it?
     
  2. Well yes it's taking space, but that's not a bad thing, as long as you are using it efficiently. 40 ItemStacks is nothing, the server won't get a huge lag spike or anything. Just remember, YAML files are mostly used for small data structures, so keep that in mind. If you really worried about experiencing issues, you could load all of them in Sync or use a Queue-Like system, similar to sync threading.
     
  3. What I would normally do is store the data in a YAML file, I normally use an ArrayList for listing stuff though.
     
  4. Make a constructor in your main class along with variables for the threads, and just loop through your itemstacks so you can load them one by one.
     
  5. Does it has to be static? Are you declaring it static to stay always in an instance class or something, or are you making it static to make it yourself easier to access? Because static is a memory tool, not an tool to access something easier.
     
  6. I dont think so, It shouldnt unless the servers ram is SUPER low
     
  7. Definitely not. Is this even a serious question?

    Here, tell you what. Serialize those itemstacks to a file. A simple yaml file will suffice. Just do getConfig().set("item1", itemstack1); for all your itemstacks. Hell, save the entire List of them if you want. Save, then tell me how big that file is.

    Hint, that file takes up more drive space than the items take up in memory. ;)
     
    • Like Like x 1