.

Discussion in 'Spigot Plugin Development' started by Valon750, May 25, 2016.

Thread Status:
Not open for further replies.
  1. .
     
    #1 Valon750, May 25, 2016
    Last edited: Nov 10, 2019
  2. No, it defaults to using the permissions.yml file in the server's main directory.
     
  3. MiniDigger

    Supporter

    bukkit has a small tutorial on how permission in bukkit work, go check that out: http://wiki.bukkit.org/Developing_a_permissions_plugin
     
  4. MiniDigger

    Supporter

    mmh. I am not sure if this will work:
    You could try to iterator over all permission attachments a player has using getEffectivePermissions and check how set the permission. I think that if there is no permission plugin installed a player can't have permission attachments, created by a plugin.
    Links to the doc:
    https://hub.spigotmc.org/javadocs/s...ns/Permissible.html#getEffectivePermissions()
    https://hub.spigotmc.org/javadocs/s...PermissionAttachmentInfo.html#getAttachment()
    https://hub.spigotmc.org/javadocs/s...issions/PermissionAttachment.html#getPlugin()
     
    • Agree Agree x 1
  5. MiniDigger

    Supporter

    because it is not needed...
    you can always use hasPermission and just don't care about it. if a permission plugin is enabled, that will handle the requests. if not it will default to the op status.
     
  6. MiniDigger

    Supporter

    well, thats because plugin developers don't register thier permissions in the plugin yml. you can change the default value there.
     
  7. JamesJ

    Supporter

    It checks if the player has any PermissionAttachments, if it does:
    -> it checks if the attachment contains the specified permission, returns whether it does or doesn't.

    Otherwise, it checks all the enabled plugins, checking their plugin.yml for registered permissions:
    -> If it finds the permission, and it's "default: true", then it returns true.
    -> otherwise, it returns false (the player doesn't have the permission).
     
  8. Not having a permissions plugin is impossible, Bukkit itself sort of contains one with two groups: ops and non-ops. Users just need to learn how to use it is all. You can use permissions.yml to create a default true parent node granting all child nodes you want players to have.

    That aside, the others are correct. However, blindly accepting any PermissionAttachment as a permissions plugin also has its flaws. For example, I've used PermissionAttachments for stuff such as anticheat bypasses when calling additional block break events. That plugin would result in a false positive - there's no way to configure it to register additional permissions, it just registers anticheat bypasses, calls events, then unregisters them.

    Honestly, I think you should just write your plugin how you would assuming users have a permissions plugin, and if it's a consistent problem add a description section explaining how to use permissions.yml or linking to its documentation.
     
Thread Status:
Not open for further replies.