ickerio / factions

Highly customizable, lightweight and fully featured factions mod for the Fabric loader in Minecraft
MIT License
25 stars 28 forks source link

Configurable claim constraints #19

Open ickerio opened 3 years ago

ickerio commented 3 years ago

Is your feature request related to a problem?

Some users in the discord have described that they would like to limit claims being made on world borders and other areas.

Describe the solution you'd like.

I propose a configurable constraints system in the config file that allows the server moderators to write human readable constraints that the mod will check against before confirming a claim. These constraints can include dimensions and world or chunk coordinates.

This is my current proposal. An admin can create as many constraints as they see fit and a claim must pass each one before it is actually registered. If a claim fails any or multiple constraints then the first constraint to fail's message will be sent to the user in chat.

The following is an example that prevents people from claiming within 3 chunks of 0,0 and past chunk coordinates of 128,128 in any cardinal direction. Note that these are not in block coordinates but chunk coordinates. The final constraint prevents any claims that are in dimensions other than the overworld (where * means all). If

"claimConstraints": [
    {
        "dimensions": { "include": ["minecraft:overworld"] },
        "lessThanX": 3,
        "lessThanY": 3,
        "message": "You cannot claim in world spawn"
    },
    {
        "dimensions": { "include": ["minecraft:overworld"] },
        "greaterThanX": 128,
        "greaterThanY": 128,
        "message": "You cannot claim near the world border"
    },
    {
        "dimensions": { "include": "*", "exclude": ["minecraft:overworld"] },
        "disallowed": true,
        "message": "You cannot claim outside of the overworld"
    },
]

Obviously I'm very open to discussion but I believe this format is able to be implemented and is very human readable.

Describe alternatives you've considered.

I have been experimenting with adding a dimension whitelist / blacklist system for claims but I feel like this is much more powerful and expansive

Agreements

Other

No response

ickerio commented 3 years ago

I've assigned myself this issue and I'll be logging my progress here. My first amendment is quite significant and rather than having a disallowed field I'd like to replace it with a type field. A Claim Constraint type can be claimable, wilderness, admin. Claimable is just like the current existing behavior of the world and will act as wilderness until claimed. Wilderness is neutral territory than can be edited by players but not claimed by anyone. Admin is not claimable or editable by anyone unless they have the requiredBypassLevel (default 2) in the config.

BlueZeeKing commented 2 years ago

An alternative could be to add a special admin faction to allow for an admin claim system.