NucleoidMC / player-roles

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

Add `role` entity selector option #64

Closed williambl closed 2 years ago

williambl commented 2 years ago

This PR adds a role entity selector option, as asked for in #40.

Here is an example of usage: Screenshot_20220902_222030

Negation is supported, too:

Screenshot_20220902_222117

Multiple negated selections can be used; only one non-negated selection can be used.

Unfortunately, entity selector options are not synced to the client, so a vanilla client will see them as invalid: Screenshot_20220902_221347

However, they still work fine when executed.

williambl commented 2 years ago

It may be worth removing the limitation that only one role can be selected at once, so that the example of @a[player_role=mod, player_role=builder] given in #40 can be done.

This would also eliminate about half of the code of this PR, which would be good.

williambl commented 2 years ago

Although, entity selector options work with and, not or, so that example would only select builders who are also mods. Perhaps some custom syntax will be required, such as @a[role=mod|builder].

haykam821 commented 2 years ago

I think that using the same behavior as the team entity selector option would make the most sense.

williambl commented 2 years ago

That's current behaviour, as far as I can tell.