NucleoidMC / player-roles

Fabric role & permission management for servers
MIT License
38 stars 16 forks source link

Implement a VirtualServerCommandSource for specifying a custom set of roles #44

Closed ashhhleyyy closed 3 years ago

ashhhleyyy commented 3 years ago

Implements a subclass of ServerCommandSource that allows other mods to specify a custom RoleReader to be used if it is not representing an Entity.

This can be used mods such as Discord bridges, which could generate a list of in-game roles based on those a user has on Discord, to allow different levels of command privilege (eg. Discord admins can run /stop via the bridge, but moderators cannot)

ashhhleyyy commented 3 years ago

I think the interface would be a great idea, especially if it can be applied to entities too; I'll take a look at these I get back from school

ashhhleyyy commented 3 years ago

I've extracted the getRoles() method into a new RoleOwner interface that can be implemented on either custom ServerCommandSources or entities, however I wasn't sure how to implement a helper for creating VirtualServerCommandSources from existing sources, as some of the fields that need to be copied are private and lack getters, and I wasn't sure if you wanted an AW or accessor mixin in the API mod