LuckPerms

LuckPerms

41.4k Downloads

Datastore no good method to get UUID and Username

MakerTim opened this issue ยท 3 comments

commented

In the current implementation is there only one method to get all the users
https://github.com/lucko/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/storage/Datastore.java#L77
This returns a Set with UUID's

the only thing is now, that when you load a user, by UUID / some sort, for the cache, you also need a username.
Now the thing is, there is not a great way for getting Usernames instead of requesting that for every one individually.

Now what i am searching for is kind of hashmap system, for getting UUID with Username
in SQL "SELECT UUID, Username FROM ..."

Because the time needed for my own private database is now over 3min... because every user got a unique i want to know you username, if known... in single requests
while i got the feeling this could be smarter done

commented

Not quite, check my message on that commit.

commented

How do you suggest it's achieved for JSON and YAML?

Simple enough to write some queries for the SQL backing, but not so much for flatfile.

Since there's no use for this in the plugins, it would really only be an API addition, and in your case, you can just extend MySQL datastore and add the method.

(Also, why not just load all of the users and get the username that way?)
See: https://jd.lucko.me/LuckPerms/me/lucko/luckperms/api/Datastore.Sync.html#loadUser-java.util.UUID-java.lang.String-

You can just give a "null" string.