Add primary groups

This commit is contained in:
Luck
2016-06-24 18:38:05 +01:00
Unverified
parent 34ca3b3c25
commit 697b349167
12 changed files with 100 additions and 22 deletions
@@ -26,6 +26,13 @@ public abstract class User extends PermissionObject {
@Setter
private String name;
/**
* The users primary group
*/
@Getter
@Setter
private String primaryGroup = null;
User(UUID uuid, LuckPermsPlugin plugin) {
super(plugin, uuid.toString());
this.uuid = uuid;
@@ -57,7 +57,7 @@ public abstract class UserManager {
* @param user The user to update or set
*/
public void updateOrSetUser(User user) {
if (!users.containsKey(user.getUuid())) {
if (!isLoaded(user.getUuid())) {
// The user isn't already loaded, so we can just add
users.put(user.getUuid(), user);
// They're probably not online, but in case they are...
@@ -65,6 +65,7 @@ public abstract class UserManager {
} else {
// Override the user's current loaded nodes, and force a refresh
users.get(user.getUuid()).setNodes(user.getNodes());
users.get(user.getUuid()).setPrimaryGroup(user.getPrimaryGroup());
users.get(user.getUuid()).refreshPermissions();
}
}