possible lag?

Discussion in 'Plugin Development' started by Protophite, Jan 19, 2017.

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

    Protophite

    Would looping through 5000-10000 file checking for 1 section in each file, be server extensive? will players feel a 2 second freeze/rubberband?
     
  2. Offline

    Zombie_Striker

    @Protophite
    Depends on your system. How good is your CPU.

    I'm assuming this is for player data. If you only have a small amount of data for each player (under 100 lines in the file), merge the files.
     
  3. Offline

    mythbusterma

    @Protophite

    What are you trying to do? I bet we could figure out a better way if you told us.
     
  4. Offline

    Protophite

    @mythbusterma
    I store data for player in a YAML file. When a player joins I store everything in a custom player object. When the player leaves/quits, the object is stored in a list. Every so often the variable is cleared and everything saves to their file. Please tell me the most effective way besides MySQL. That's basically what I'm doing. I needed to iterate through all files if I wasnt able to get a players UUID. It was solved by using this:

    Code:
    OfflinePlayer op = Bukkit.getOfflinePlayer(playername); //deprecated
    if(op.hasPlayedBefore())
    //get UUID
    //retrieve the file
    //blabla
     
  5. Offline

    JanTuck

  6. Offline

    Protophite

    @JanTuck I find storing every player in 1 huge file a bit weird and inefficient.
     
  7. Offline

    JanTuck

    @Protophite

    Fine.
    You can save it with the name of their uuid. And then just load that file on join.
     
  8. Offline

    Protophite

  9. Offline

    JanTuck

  10. Offline

    DoggyCode™

  11. Offline

    mythbusterma

    @Protophite

    Well it doesn't have to be MySQL, you could do SQLite or PostgreSQL. But the best option is definitely using an SQL database, indexing the field, and then searching on it.
     
Thread Status:
Not open for further replies.

Share This Page