RegionsAPI
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:
- RegionService
- Region
- RegionBuilder
- RegionFlag
- RegionShape
- 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)
- (PluginRelatable)
- (RegionParentable)
Basc idea
A Region
contains:
- a
RegionShape
object which defines the boundaries of the region - a id as
String
for easy identification - optional multiple
Region
objects as parents for inheritance of flags - optional multiple
RegionFlag
objects
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 RegionService
.
Very basic 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
##Events
These events are triggered by any entity that are in triggering range. This should include mobs, players, etc.
Entering a region:
- APPROACHING_BORDER_FROM_OUTSIDE
- ENTERING
- ENTERED (This should also be triggered if entitys are teleported, warped or spawned into the region)
Leaving a region:
- APPROACHING_BORDER_FROM_INSIDE
- LEAVING
- LEFT
Shapes/Flags
- SHAPE_CREATED/REMOVED/EDITED
- FLAG_CREATED/REMOVED/EDITED
Features
- Will come with an implemented RegionService here: JanosRegions GitHub
Source
You can view the current source code here: RegionsAPI GitHub
Info
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.
Your part!
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