1.16.5 Player.hasPermission(permission) always returns true even if they don't have the permission

Discussion in 'Spigot Plugin Development' started by burby_99, Jun 15, 2021.

  1. I have a block of code here that is supposed to give a player the head of the person they killed when they die. I check if killer.hasPermission("headdrop.candrop") but it still returns true and gives the player head even when the killer doesn't have the permission headdrop.candrop. Did I mess something up with the permissions?

  2. Could you give a list of the permission nodes that 'killer' had in your test
    I dont neccessarily see anything wrong with the code
  3. Are you completely sure that the player isn't an operator? You can assure by just de-opping them.
  4. How do you define the permission in your plugin.yml file?
  5. permissions:
    description: Gives the killer a chance to get the victim's head on kill
  6. I'll try that, but in the future, is there a way to disable operators from being able to do that? I want it to only happen for a specific group of people
  7. Ops always have most permissions on Bukkit-based servers. There's no way to turn that off that I know of. Most servers using ranks/permissions avoid giving anyone op for precisely that reason.
  8. Yes, actually, you can check if the user is opped in your if check.
    Code (Text):
    if(!sender.isOp() && sender.hasPermission("perm")) {
    I believe you also can make operators powerless by setting
    Code (Text):
    to 0 in the server.properties, I'm not 100% sure though so please get back to me on that.
    #8 S1ant, Jun 15, 2021
    Last edited: Jun 15, 2021
  9. i googled and found this, Bypass OP Permissions?

    try adding below description (under permission, headdrop.candrop)
    default: false
  10. Thanks. I'll try that and if doesn't work I'll reply back. If I don't reply, then you know what happened.

    I'll try it as well. Thanks
  11. Whoops, big mistake '||' > '&&'
  12. You need to add default: false