The player#hasPermission method it's returning false for temporary permissions?
Tyguh opened this issue ยท 5 comments
The player#hasPermission method it's returning false for temporary permissions.
if (!player.hasPermission("essentials.fly") || !player.hasPermission("superior.island.fly")) {
#this check here works
player.sendMessage(this.getMessage("no-permission"));
return true;
}
if (player.hasPermission("essentials.fly")) {
#this check doesn't work
this.getServer().dispatchCommand((CommandSender)player, "essentials:fly");
return true;
}
if (player.hasPermission("superior.island.fly")) {
#this check doesn't work
this.getServer().dispatchCommand((CommandSender)player, "superiorskyblock2:is fly");
return true;
}
It doesn't work for other conditions because it's checking if they have the permission node. They do have the permission node but it's assigned temporarily.
ok.. but whether its temp or permanent they still have that perm and player#hasPermission
should return the same result. If you think otherwise, you will have to provide evidence showing the issue (e.g. logging of the player#hasPermission
result).
assuming the code is order as how you show it, how can hasPermission
in the first if condition work, but suddenly the next if condition it returns a different value? Unless the code were pasted from different parts of your project?
I feel like there is a flawed logic rather than player#hasPermission
not working.
For it to even reach the second if condition, both essentials.fly
AND superior.island.fly
needs to be true. Furthermore, this will result in it being completely impossible to reach the third if condition, since at that point, essentials.fly
will definitely be true and it will break out at the second if condtion.