Skip to content

Add custom Domains for domains used through the api#1866

Merged
Joo200 merged 2 commits intoEngineHub:masterfrom
Joo200:feature/apidomains
Jun 4, 2023
Merged

Add custom Domains for domains used through the api#1866
Joo200 merged 2 commits intoEngineHub:masterfrom
Joo200:feature/apidomains

Conversation

@Joo200
Copy link
Collaborator

@Joo200 Joo200 commented Dec 29, 2021

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:
    • ApiDomain --> maybe CustomDomain?
  • Display the names of the custom ApiDomains (or domain.toString()) in /rg info
  • Add this to sql storage (or ignore it) we just ignore it, sql storage can't handle custom domains.
  • Check the usage to fit the needs
  • Check whether the ApiDomain storage does work fine
  • Code cleanup
  • Documentation

@Joo200 Joo200 force-pushed the feature/apidomains branch from 5d49557 to 7771e06 Compare December 30, 2021 19:53
@wizjany
Copy link
Collaborator

wizjany commented Dec 31, 2021

initial thoughts:

  1. CustomDomain > ApiDomain
  2. 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:somevalue in 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?)
  3. following 2, : should not be a valid character in domain names as that should split the name and value when parsing

@Joo200
Copy link
Collaborator Author

Joo200 commented Jan 1, 2022

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].

@Joo200 Joo200 changed the title Add Api Domains to add custom domains Add custom Domains for domains used through the api Jan 1, 2022
@Joo200 Joo200 added status:pending Pending acceptance or closure. type:api Describes a bug/feature request regarding API usage labels Jan 1, 2022
@Joo200 Joo200 force-pushed the feature/apidomains branch from 4435b30 to 1f32702 Compare January 29, 2022 18:57
@Joo200
Copy link
Collaborator Author

Joo200 commented Jan 29, 2022

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?

@Joo200 Joo200 marked this pull request as ready for review January 29, 2022 18:59
@wizjany
Copy link
Collaborator

wizjany commented Jan 29, 2022

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.

@wizjany wizjany added this to the 7.1.0 milestone Jun 14, 2022
Joo200 added 2 commits June 4, 2023 18:54
This change allows third party plugins to dynamically add custom domains to WorldGuard.
@Joo200 Joo200 force-pushed the feature/apidomains branch from 669e68c to d1ac877 Compare June 4, 2023 16:54
@Joo200 Joo200 merged commit bb3fdcc into EngineHub:master Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:pending Pending acceptance or closure. type:api Describes a bug/feature request regarding API usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants