Vault

Vault

7M Downloads

.playerInGroup() bugs

CJxD opened this issue ยท 1 comments

commented

Within the last few months, using PEX on my server, my plugin that requires finding whether I am in a given group, returns true if I inherit that group but am not in it myself.

While it's sort of correct, it was totally bloody useless for me, so I changed my plugin from:

boolean allowed = vault.playerInGroup(e.getPlayer(), group);

to:

List<String> groups = Arrays.asList(vault.getPlayerGroups(e.getPlayer()));
boolean allowed = groups.contains(group);

and that worked properly. It would only report true if I was actually in the group explicitly.

And then I started getting complaints saying "group perms don't work u suk" because it seems people using GroupManager seem to always get allowed = false despite which groups they're really in.

Obviously I could then change my code again, but I thought I'd pass it by you to see if you could do anything your end or whether I'm being an idiot.

Many thanks

commented

group checking is a bit of a pain, since you need to check both global groups and world-specific groups. ATM you're only checking world-specific groups, there really isn't a way around it in Vault, as Vault reports back whatever the APIs in permission plugins do. You can try alos checking global groups to see if that help with the issue. Instead of only passing in the player, also pass in a (World) null.