LuckPerms

LuckPerms

41.4k Downloads

Vault .getPrimaryGroup() returns null

KateHutch opened this issue ยท 7 comments

commented

I'm running into an issue using LuckPerms with Vault - I can't get the primary group of offline players.

I need the primary group because my vote plugin, VoteRoulette, uses it to determine who gets what reward.

At the moment using .getPrimaryGroup(String world, OfflinePlayer player) returns null if the player is offline or on another server within the bungeecord network, which means they just get the default reward.

It works 100% fine if the player is online, but doesn't work if they are offline.

Any ideas on ways I can try troubleshooting this issue?

commented

Cool, so just to clarify: if I can't pull data from LP using the OfflinePlayer version of the method, can I use the deprecated Vault method .getPrimaryGroup(String world, String player) to pull the info from LP even if the player is offline?

commented

No, you cannot pull data using Vault about offline players.

commented

I must be going mental. So the method getPrimaryGroup(String world, org.bukkit.OfflinePlayer player) listed here doesn't actually work for OfflinePlayers?

https://milkbowl.github.io/VaultAPI/net/milkbowl/vault/permission/Permission.html

commented

Correct. You cannot query data about offline players, as their data is not loaded.

commented

Cool! Thanks for the help. I'll go try out the API and see if I can get it working. :)

commented

Alrighty, let me know if you have any issues. :)

commented

You cannot pull data for offline players using Vault.

Why? It will lag your server if those methods are called on the main thread.

If you need to get the data of offline players, you need to use the LuckPerms API, and make sure you load the data in async. I'm happy to help you do that if you're struggling. :)