WorldGuard
WorldGuard copied to clipboard
Add custom Domains for domains used through the api
Sometimes it can be handy to add custom domains instead of the player uuid, name or a permission group.
E.g. if you have more dynamic domains or you don't want to sync the members and/or owners between your region and worldguard.
Idea
Add some own domains to the DefaultDomain of regions. E.g. add your custom domain which determines the membership status by playtime.
You add your "ApiDomain" (maybe we can find a better name here) to the DefaultDomain with some informations how to parse your custom Domain to the regions.yml and backwards. There is a Registry for custom Factories for ApiDomains, where you have to register the ApiDomain and the Factory in onLoad (like the existing FlagFactory).
Missing points
- [find better names:
- [x] ApiDomain --> maybe CustomDomain?
- [x] Display the names of the custom ApiDomains (or domain.toString()) in /rg info
- [ ] Add this to sql storage (or ignore it)
- [x] Check the usage to fit the needs
- [x] Check whether the ApiDomain storage does work fine
- [x] Code cleanup
- [x] Documentation
initial thoughts:
- CustomDomain > ApiDomain
- there's no support for command usage or parsing yet, which means domains have to be added to regions by api. we should ultimately allow for
/rg addmember <id> mydomain:somevaluein command usage. (wonder if it might be useful to have a perm for which domains can be used similar to the way flags perms work?) - following 2,
:should not be a valid character in domain names as that should split the name and value when parsing
I looked in the code and I don't think we should add the custom domains to /rg addmember|addowner|removemember|removeowner commands. With the current DomainInputResolver there is no way to check for actors permissions and there is not really a "context" for the CustomDomain (e.g. the actor, the used ProtectedRegion or whether it's the owner or member domain).
Two new commands should work better for that:
/rg ownerdomain <region> <domainname> [input] and /rg memberdomain <region> <domainname> [input]
Command syntax is like the /rg flag <region> <flag> [input].
I removed the new commands as discussed on the discord. After some tests it looks fine for me, it works fine for me.
Maybe there should be some way to get a list of available custom domains but I don't know how that should be done.
e.g. /rg domains? or /rg addmembers/addowners/delmembers/delowners?
not super-worried about discoverability atm as these will probably be niche for a while and will never be as much as flags. once piston happens suggestions will help.