Best practices for ... & advice requested

Discussion in 'Plugin Development' started by MrGeneralQ, Aug 10, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    MrGeneralQ

    Good day everyone

    I'm about to start working on hopefully a new essential quality plugin. Before I start, I want to make
    sure that everything I do is according to best practices.

    This thread is not meant to spoongive me code. I'm looking for ways of doing something. If you are experienced it would be much appreciated if you could help me out here with my following questions.

    Questions:

    1. If I want to store player inventories. How do I do that? I heard as of 1.13 , there is no longer such thing as ID's. Linked to this question, where do I store them? SQLI, MySql or a file? I'm looking for performance based solution.

    2. Storing data, where do I do that? Again, I'm looking for a performant solution. I heard for things such as coreprotect , it's best to use MySql altough I never understood why. Is there any best practices for certain data to be stored on certain ways?

    3. Multiple configuration file, how do I start using that? Is there any professional library available? Would it be better to create it myself and if so, how do I start doing that?

    I thank you in advance for reading my thread and perhaps helping me out.

    Best regards,

    Quinten
    MrGeneralQ
     
  2. Offline

    Zombie_Striker

    First, don't use IDs. Since ItemStacks can contain a bunch of data, including NBT data, and since ItemStacks implement ConfigurationSerializable, you can simply store the whole itemstack instance to a config file if needed:
    1. Unless you need the inventories to be able to be read from multiple servers *(something bukkit does not support), SQL is more performance/memory intensive. You should use files/ymls.
    2. To account for corruption/file sizes, each player should have their own YML file to store their data.
    Again, unless you need multiple server support (something we don't support), all data storage should be done through files.
    If you just need YML files, use FileConfigration and YamlConfigration classes.
     
    MrGeneralQ likes this.
  3. Offline

    MrGeneralQ

    Thank you for this very helpfull answer. Do you perhaps have some documentation or post about the serialization and deserialization?

    Verstuurd vanaf mijn ONEPLUS A3003 met Tapatalk
     
Thread Status:
Not open for further replies.

Share This Page