LuckPerms

LuckPerms

41.4k Downloads

The player#hasPermission method it's returning false for temporary permissions?

Tyguh opened this issue ยท 5 comments

commented

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;
}

commented

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.

commented

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).

commented

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?

commented

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.

commented

Check with the verbose command if you're still not sure, but as Ben said I suspect this is flawed logic in your code as opposed to a bug in LP.