Inconsistent results when adding and removing perms through code
OasisArtisan opened this issue ยท 2 comments
What i'm trying to do if u need it:
So i'm making a simple addon plugin where it takes a permission that has a number and increase it or decrease it so for example if i had a permission pets.number.4 the command would recognize the player has that permission and would remove it and add pets.number.5 instead.
however when i add and remove perms through vault api it fails a lot of times without returning a false value meaning there is no way of making sure if the permission was actually added or removed. so i made a simple block of code to test that the problem isn't from me.
my code:
inside a command executer:
player = Bukkit.getOfflinePlayer(UUID.fromString("356c9d6f-c039-4efa-a82a-13c34cb1f1ca")); for(int i = 0; i < 100; i++) { int j = i -1; boolean b1 = perms.playerRemove(null, player, "why." + j); boolean b2 = perms.playerAdd(null, player, "why." + i); if(!b1 || !b2) { sender.sendMessage("Fail at " + i); } }
perms is defined on the enable method as
Permission perms = getServer().getServicesManager().getRegistration(Permission.class).getProvider();
and the result of this code inside my permissions file in the first 5 runs was:
[1]:
why.99
why.7
[2]:
- why.99
- why.95
- why.91
- why.85
- why.76
- why.63
- why.59
- why.55
- why.37
- why.23
- why.22
[3]:
- why.99
- why.76
[4]:
- why.99
- why.90
- why.85
- why.84
- why.81
- why.73
- why.70
- why.67
- why.60
- why.42
- why.39
- why.27
- why.22
- why.19
- why.0
[5]:
- why.99
- why.39
- why.11
as you can see there is absolutely no pattern or logic behind the results especially since i didn't get any fail messages.
my permissionex version: "1.23.4"
my vault version: 1.5.6-b49
i do not have any other permission managing plugins
Please help me to keep using your awesome plugin :)
thanks in advance
Programming stuff; @zml2008 will have to handle this ticket.
Unfortunately PermissionsEx is currently unmaintained and no further updates are planned. Because of this, all pull requests are being closed. If you are looking for an actively maintained permissions plugin, take a look at LuckPerms. It is compatible with major server platforms and can import data from PEX.