Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by Valon750, May 25, 2016.
No, it defaults to using the permissions.yml file in the server's main directory.
bukkit has a small tutorial on how permission in bukkit work, go check that out: http://wiki.bukkit.org/Developing_a_permissions_plugin
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:
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.
well, thats because plugin developers don't register thier permissions in the plugin yml. you can change the default value there.
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).
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.