This will provide an API as addition to the SpongeAPI for the use of regions with different plugins. More will coming soon…
Interfaces / AbstractClasses
RegionsAPI will possibly contain the following Interfaces/AbstractClasses ready for implementation for any Regions-Plugin:
- RegionEntityEvent (for events related to entites)
- RegionShapeEvent (for events related to edit a region’s shape)
- RegionFlagEvent (for events related to edit a region’s flags)
RegionShapeobject which defines the boundaries of the region
- a id as
Stringfor easy identification
- optional multiple
Regionobjects as parents for inheritance of flags
- optional multiple
So any plugin can see if there are regions or create/modify them. Regions and flags can be marked as related to a specific plugin.
How to build a
Region: You can either make your very own factory class for this or you can implement/use the
RegionBuilder. The builder allows you to create a region over some time, so there are no unfinished regions registered in the
RegionShape: Because of the simpleness of the shapes, everything can be implemented as a region shape, you could implement many shapes like chunk-based shapes or vertice-based shapes. A region can always change its shape, for example convert it from a chunk region to a vertice region or vice versa.
You can get the current class diagramm here: RegionsAPI classes
These events are triggered by any entity that are in triggering range. This should include mobs, players, etc.
Entering a region:
- ENTERED (This should also be triggered if entitys are teleported, warped or spawned into the region)
Leaving a region:
- Will come with an implemented RegionService here: JanosRegions GitHub
You can view the current source code here: RegionsAPI GitHub
So, yeah. I thought someone has to do this
Idea and opinions are welcomend at every time, The developing of the base structure is still in progress and far from finished.
How would you want to use it? What do you need?
- Your help is appreciated!
You want to implement/use the API?
- If you use Gradle for your project, follow this tutorial for a proper import: Gradle GitHub-dependency tutorial