ldtteam / minecolonies-features

This is a repo only to discuss minecolonies features (requested and planned)
10 stars 3 forks source link

Entity Interact Whitelist #819

Open nirp-s opened 4 months ago

nirp-s commented 4 months ago

Prerequisites

Context

Is your feature request related to a problem?

This feature would solve many problems, but the most important use case is for recovering items from player corpses in the Corpse mod.

Feature description

This feature would essentially be a copy of the existing interact whitelist for blocks, allowing a player to prevent entity interactions from other players in the colony, except for when they interact with a set of entity IDs explicitly listed in the permissions.

Notes or related things

Additional filters such as NBT data would be helpful as well, so that the colony could for example allow interacting with horses, but exclude their own horses by name. (so this part of the feature would specifically need an exclude or "logical not" option to be most useful)

An example entity whitelist using a rough syntax that will have to be ironed out for actual implementation: corpse:corpse minecraft:horse{!CustomName='{"text":"HorseName1"}',!CustomName='{"text":"HorseName2"}'}

Player corpses likely also have some NBT that the player can exclude to protect their own corpses and corpses of colony allies in their colony. They will already have full entity interact permission, so they don't need them to be whitelisted. Excluding those corpses from the whitelist prevents them from being opened by other players, so this additional feature is also quite important for improving the main intended purpose of this feature.

Another option for excluding entities from the whitelist would be a specific tag that players can set on entities somehow to give them special preservation, such as a Protect Entity Tool that they click entities with to add a "SpecialNoInteract=ThisColonyID" tag. Then the custom NBT entity filtering system would be unnecessary, and instead Minecolonies could check only this tag in special exclusions. The perfect system with the most versatility would be having both features, letting players add this special tag to entities and having the generalized custom NBT filtering system which can utilize the SpecialNoInteract tag as one of the exclusions. Players can get their colony ID from "/mc colony list" to use in that exclusion tag. This would have some convenience benefits, such as not having to add a huge list of names for the NBT filter. Just tag every entity you want to exclude from the whitelist and put that single NBT tag with the value equal to your colony ID as the exclusion.

The use of the colony ID is a specific choice so that other players bringing in their own protected entities won't lose access to them. There would be no way to distinguish their protected entities if every entity had "SpecialNoInteract=1" for every colony. Players would bring their personal excluded horses into another colony, and that colony would see the horses as protected entities because they have the tag. Setting the tag to the colony ID prevents this. Players could exclude other players' colony IDs to steal the entities they bring in, but they already can anyways in the permission system's current state. This is all to allow colony owners to make the choice to do a service for visiting players while not risking anything of their own. In that vein of doing a service for players, it would be nice if there was also some way for any player to check a colony's entity whitelist so that they can be assured that the service is being provided. For example, they can check the whitelist, see horses, and dismount their horse in the colony knowing they will be able to attach a lead or remount. This generalized system will also work out of the box with other entities, such as Hexerei brooms which are essentially identical to horses, and just like with horses, this system is desperately needed to let players remount their brooms in a colony.

In summary, requested features are:

  1. Entity whitelist, the main feature
  2. Whitelist entities based on NBT, including logical negation of NBT, i.e. exclude from whitelist when certain NBT is present
  3. A special tagging tool which applies a tag onto the entity, the value of which is the colony ID that the tool is associated with (this tagging tool can be either a replacement for feature 2 or an improvement upon feature 2)

Viewers