LuckPerms

LuckPerms

41.4k Downloads

Multiple "same" permission in different groups

SeruhioX opened this issue ยท 7 comments

commented

Previously I asked a question in the official plugin thread in spigot

https://www.spigotmc.org/threads/luckperms-an-advanced-permissions-plugin.174259/page-60#post-2526176

The question is the same one I did there.
In my server I give temporal ranks, and when they finish they must return to an old rank (different in each case), therefore I can not do "set" or put it of primary group.

When a user has several similar permissions, he sometimes chooses the right one, sometimes not

I explain it a bit better in the official thread, the groups have the correct weight, I have tried to deny permissions from one group to another but none of this works

commented

Sorry, I must've forgotten to reply to you on the thread.

I'm not sure why that's happening. Your description of the setup on the Spigot thread sounds spot on. I can't see why there would be an issue there.

My only guess is that towny is doing something silly with the lookups. The best way to diagnose this would be to use the verbose command.

https://github.com/lucko/LuckPerms/wiki/Verbose

This should hopefully let you see where things are going wrong.

commented
commented

Seems like Towny uses a players primary group, and ignores any other groups or permissions they may have.

So, you can't set the max plots meta value to the user directly. You have to set it to their primary group.

https://github.com/ElgarL/Towny/blob/master/src/com/palmergames/bukkit/towny/TownySettings.java#L1675
https://github.com/ElgarL/Towny/blob/master/src/com/palmergames/bukkit/towny/permissions/VaultPermSource.java#L70

If it cannot find a value via meta, it falls back to this method, which will just use the first value it finds...
https://github.com/ElgarL/Towny/blob/master/src/com/palmergames/bukkit/towny/permissions/TownyPermissionSource.java#L72

That's why you're getting strange results. It's not a LuckPerms issue, just crappy Towny design. :(

commented

I'm looking into this, we weren't actually using getPrimaryGroup(), so it was acting the way you said it does. Can't help it if that part of towny was written before primary groups were a thing...

commented

Thank you both for your time and for helping me with my problem.

commented

we weren't actually using getPrimaryGroup()

https://github.com/ElgarL/Towny/blob/master/src/com/palmergames/bukkit/towny/permissions/VaultPermSource.java#L67

That's what that method does.

Can't help it if that part of towny was written before primary groups were a thing...

You're using the method for it? I don't understand what you're trying to say?

The sane way to handle this is to either return the max value found here:
https://github.com/ElgarL/Towny/blob/master/src/com/palmergames/bukkit/towny/permissions/TownyPermissionSource.java#L71

instead of just returning when the first result is found, or to use Chat#getPlayerInfoInteger, and query the player, not their primary group.

commented

Took care of it already, TownyAdvanced/Towny@11866ec

We were not using the preffered getPrimaryGroup(world, offlineplayer), instead just getPrimaryGroup(player) which your plugin doesn't defined in your vault section. SeDark tested this change and it works properly now.