Moving groups with GroupManager doesn't work
ElgarL opened this issue ยท 7 comments
permission.playerAddGroup(sender.getWorld(), sender.getName(), rankx);
Nor does playerRemoveGroup. Nothing at all happens.
Vault does not hook GM's group add/remove methods because there is no consistent way to do it. Vault has no reference to primary/secondary groups and the inclusion of this in GM messes with how Vault would normally handle group removal/addition.
Has GM added simple add/remove methods yet?
AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldData(player).getPermissionsHandler()
from there you have a number of options.
Or to directly modify the user add/remove groups...
groupManager.getWorldsHolder().getWorldData(player).getUser(Player.getName())
the User objects do not have proper addGroup removeGroup methods, it only has setGroup and addSubGroup and removeSubGroup. This is a direct incompatibility that needs to be altered inside of GM for Vault to support it 100%.
It won't be changed in GM (As I'm the dev). You may only have one main group with GM, which is why it's setGroup. It needs no remove group.
Any additional groups are in subgroups.
So add helper methods with all the logic for addGroup/RemoveGroup?
GM is the only permissions plugin w/ API that does not support doing this natively.
Of course it supports it. It just doesn't support it how YOU want it. You are hooking GM, not the other way around.
GM only allows ONE primary group so a removeGroup is redundant. You simply setGroup to whatever primay group you want. You do not need a removeGroup.
SubGroups are all the secondary groups you can be a member of and they DO support add and remove.
If you don't want to support GM then thats not an issue.