Do we need a region API?

There are also setCreator and setNotifier methods: SpongeAPI/Extent.java at 648d95fb613ccb7020fce645dddaf703fb01130a · SpongePowered/SpongeAPI · GitHub

@gravityfox

In regards to testing permissions at a location, does the context of the player get correctly calculated? If so testing for a permission, at a location should work as the context calculator would apply the correct context needed?

If it’s currently clunky, maybe creating methods for players acting at a distance need to be added, where the contexts can be determined for acting at a distance.

1 Like

See… all this context and context calculator stuff is driving me up a wall.

Foxguard does not employ the use of permissions internally.

That way when you break a block, it checks against the block location, not the player location.

That way I can avoid all this player position nonsense.

So we need a new API for that? As I understood Contexts aren’t useful here because these are only contexts of players and not blocks.
The solution would be a standardized API?

I think we do need a more generalized way of assigning certain parts of the world to certain “things,” I’m just a bit worried that this so-called region api could be potentially restrictive. If we get a region api, it ought to be a good region api… or at the very least, a simple, malleable, one.

1 Like

Well, if you do what FoxGuard does, and define a region as simply some volume of space, then it becomes very malleable. Regions could then be any shape and size.

Since plugins would only be concerned with what regions a specific location falls under, they do not need to be aware of the shape of each region.

So there’s a start.

You can go further and define properties that some regions could have, such as ownership, block iterability, or dimensions.

It depends on what people will actually use it for.

However removing the shape restriction would make it a lot easier for people to implement and provide that service.

HOWEVER!!! There is still one problem with having a service. Unlike in the case of an Economy plugin, where having two different econ plugins is just weird, it is entirely likely that you would have two or more plugins that could provide regions. In that case, you would need some way for all of them to cooperate, and that there is the hardest part.

I think some devs are only active on GitHub so I opened an issue there.

One thing to keep in mind is this ‘ownership’ thing. When defined by the API it could be too restrictive. There could be

  • a creator which created the region and always has all rights to modify the region
  • owners which have all rights to modify the region, this ownership can be transferred
  • members that can simply build but not modify lets say “flags” of regions
2 Likes

Well. You can always do it like economy or permissions API:
Provide a standarized API which one plugin implements and all other plugins rely on it.

The best solution then is to have the plugins that would otherwise provide a region implementation use a configuration node that specifies whether or not to actually implement it. So a plugin that is designed for cuboid regions, and provides a cuboid region, can bow down to another plugin that can provide randomly-shaped regions, without losing any functionality.
Probably a supports() method of some sort would be a good idea.

What are the main use cases for needing worldguard / foxguard integration?

Normally as far as I can tell,

  1. Custom flags / data attached to regions.
  2. Does player have permission to do x action at y location.
  3. Create regions automatically to have claim assists / automatic plot creations.
  4. Change ownership / membership of a region, rent/selling/raiding

For what I would like to do 2. fits the best.

In addition to “2”, also

“Does player have permission to do x action with y Block/Entity/TileEntity”, etc.
And, I suppose

“Does Entity x have permission to do y action at z location, and y action with z block/entity/tile-entity”

Like, does a creeper have permission to blow up, does pokemob (no I don’t use the mod) have permission to attack a sheep, etc… not that mods would use it but other plugins.

Also, this could instead be a “Region API Registry”… though that would be a little odd.