[SOLVED] How to implement PermissionService

Greetings All,

I suspected that I may get mixed feedback on this question, but if you don’t try you’ll never succeed.

I’m currently looking at creating a small permissions plugin using the SpongeAPI and it would appear that I need to implement the PermissionService interface. I know a lot of people may think, why not use PermissionsEx, and the simple answer to this is that I could indeed use this plugin, but I’m determined to create my own for a small server that I run, a kind of challenge to say the least.

I’ve had a few attempts to implementing the PermissionService, and have been reading through the ported PermissionsEx plugin code to see if I can determine the steps required to create such a plugin, but I’m struggling.

The plugin that I wish to create will be much less complex in comparison with PEx, so I’m only looking for guidance on how to create a basic implementation of a permissions plugin at the moment.

Would anyone be kind enough to offer guidance on this please?

Many Thanks,

Define much less complex.

Thanks for replying.

The plugin will be able to assign permissions to users and groups. I have this functionality already in place for the storing and retrieving of this information via a database. There is currently no need for any global permissions or multi world permissions.

I am struggling with implementing the permissionservice itself. I think once I’ve got a basic implementation I’ll be able to move some of my existing code from the test plugins I’ve created to accommodate other functionality of the plugin.

Currently all of my test plugins I’ve created can only be run as op because of no permissionservice to accommodate the. This in a nutshell is what I want to provide.

Take a look at https://github.com/SpongePowered/SpongeCommon/tree/master/src/main/java/org/spongepowered/common/service/permission

That’s the Sponge implementation that’s based on minecraft’s default OP level system.

You’d need to implement something similar, but getting/setting the permissions with SubjectPermissionData however you want.

Thank you very much @ZephireNZ for the link above, after studying the default implementation I’ve now completed my implementation of PermissionService :smile: