LuckPerms

LuckPerms

41.4k Downloads

User#setPrimaryGroup() broken as well?

Aerodog opened this issue ยท 4 comments

commented

getPrimaryGroup works, but setPrimaryGroup does nothing and never returns null unless the user is null.

commented

Can you show me some sample code?

I wasn't able to reproduce this in my attempt.

commented

https://paste.md-5.net/vikewasubu.java

I've tried groupName.getFriendlyName(), groupName.toString(), groupName.getDisplayName()... it broadcasts the message but doesn't change the group.

commented

You need to make a call to UserManager#saveUser after setting the primary group.

Also consider that setPrimaryGroup doesn't actually add the membership. You need to do that bit first as well.

See here for more info: https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage

I suggest reading all of the sections up until the bit you're interested in. It introduces a lot of important concepts within the API. :)

commented

ty