Is there a better way to make unlockables than saving players in an arraylist and saving in config?

Discussion in 'Plugin Development' started by xpaintall, Apr 5, 2021.

  1. Offline


    Ok, so I am trying to make a cosmetics plugin. Since I've been coding for a few months now and wanting to make my own server with custom plugins, I decided to. But. There was a problem whilst developing the cosmetics plugin. I know to make all of the cosmetics, GUI's etc... but when it comes to actually getting the cosmetic (winning it by opening a cosmetic box and then unlocking it forever) I realized there was a problem. I could've put the player that got the cosmetic in an arraylist which detects if you have the cosmetic or not, but I heard that .yml files act weird when they get large. Is there any better solution to this? I am not asking for code, just a theoretical soultion. Any help would do.
  2. Offline


    Yes use a separate txt file and use Java to scan it at the start of your plugin to input the values in the array lists. Make sure to store player UUID's in the array lists and use
    to check if a player has it unlocked. I believe that should work and if you are just starting a server then why not just store the lists in the config until your server gets a large player base? It's much easier to do.
  3. Offline


    Thanks for the feedback! I want to use the .txt scanning method right of the bat just because if the server playerbase gets larger I don't want to mess things up like I usually do.
  4. Offline


    A large server will often use a database to store things like this, and they wouldn't have a list for every unlockable which is what it seems like you're doing.

    YML files are perfectly valid, you should have no problem using them.

    If you're concerned, create a YML for each player with the name being the players UUID.
  5. Offline


    @CraftCreeper6 I am not expecting to have a large server, but I got the .txt method that @davidclue recommended working. The reason why I don't want to put it in a .yml file is because I have different things to do with them later in the development of the server that are going to require changing (like a config file). The reason why I wanted to use .txt files is because it is not changeable like a config file and I always mess things up when I am trying to change something.
  6. Offline


    Just don't change anything manually? Make a command to do it for you.

    You should create backups anyway, especially if it's a big server.

Share This Page