-
Notifications
You must be signed in to change notification settings - Fork 1
Developer Documentation
API Version: 1.0.0
Compatibility: Spigot / Paper / Folia
Status: Stable
RegenSystem provides a public, stable, and event-driven API allowing external plugins to interact safely with regenerable zones, flags, and regeneration logic without touching internal implementation details.
- Introduction
- API Stability & Versioning
- Installation & Dependency (JitPack)
- Getting Started
- RegenSystemAPI
- ZoneRegistry
- RegenZone
- ZoneFlag
- RegenResult
- Events
- API Rules & Restrictions
- Internal & Experimental APIs
The RegenSystem API allows plugin developers to:
- Access all registered regeneration zones
- Query zones by name, location, flags, or distance
- Trigger regenerations manually
- Modify zone flags at runtime
- Listen to zone lifecycle events
- Integrate RegenSystem with custom game modes, GUIs, or mechanics
This API is safe, stable, and designed for production servers.
RegenSystem follows semantic versioning: MAJOR.MINOR.PATCH
RegenSystemAPI.API_VERSION
RegenSystemAPI.API_MAJOR
RegenSystemAPI.API_MINOR
RegenSystemAPI.API_PATCH| Change type | Compatibility |
|---|---|
| PATCH | Bug fixes (non-breaking) |
| MINOR | New features (non-breaking) |
| MAJOR | Breaking changes |
repositories {
maven("https://jitpack.io")
}repositories {
maven { url 'https://jitpack.io' }
}<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>dependencies {
compileOnly("com.github.DarkLashDev:RegenSystem:v2.0.2")
}<dependency>
<groupId>com.github.DarkLashDev</groupId>
<artifactId>RegenSystem</artifactId>
<version>v2.0.2</version>
<scope>provided</scope>
</dependency>depend:
- RegenSystemBefore using the API, always check availability:
if (!RegenSystemAPI.isInitialized()) {
throw new IllegalStateException("RegenSystem API not available");
}
ZoneRegistry zones = RegenSystemAPI.getZones();Central static access point of the API.
ZoneRegistry registry = RegenSystemAPI.getZones();- Expose the public API
- Handle API versioning
- Protect internal initialization logic
⚠️ init(...)is internal and must never be called by addons.
Provides access to all registered zones.
| Method | Description |
|---|---|
| getZone(String) | Get a zone by name |
| getZones() | Get all zones |
| getZoneNames() | Get all zone names |
| isRegistered(String) | Check if a zone exists |
| getTimeLeft(String) | Remaining time before regen |
| getZonesContaining(Location) | Zones containing a location |
| getZonesByFlag(ZoneFlag) | Zones with a flag |
| getZonesNear(Location, int) | Zones near a location |
Example:
Optional<RegenZone> zone = RegenSystemAPI.getZones().getZone("mine");
// Another way
RegenZone zone = RegenSystemAPI.getZones().getZone("mine").orElse(null);Represents a regenerable cuboid area.
| Method | Description |
|---|---|
| getName() | Zone name |
| getCorner1() | First corner |
| getCorner2() | Second corner |
| getCenter() | Center location |
| isEnabled() | Zone enabled state |
| getBlockCount() | Stored blocks count |
| Method | Description |
|---|---|
| contains(Location) | Check if location is inside |
| regenerate() | Trigger regeneration |
| countPlayersInside() | Count players in zone |
RegenResult result = zone.regenerate();boolean pvp = zone.hasFlag(ZoneFlag.PVP);
zone.setFlag(ZoneFlag.PVP, false);
Map<ZoneFlag, Boolean> flags = zone.getFlags();zone.highlight(
Particle.VILLAGER_HAPPY,
Duration.ofSeconds(5)
);Controls zone behavior.
- PVP
- EXPLOSION
- BLOCK_BREAK
- BLOCK_PLACE
- ITEM_DROP
- ITEM_PICKUP
- MOB_SPAWN
- MOB_DAMAGE
Parsing from user input:
ZoneFlag flag = ZoneFlag.fromString("bb");Represents the result of a regeneration.
| Result | Meaning |
|---|---|
| SUCCESS | Regeneration completed |
| SKIP | Nothing to regenerate |
| STOP | Cancelled or disabled |
| ERROR | Internal error |
if (result.isSuccess()) {
// regeneration successful
}All events are standard Bukkit events.
@EventHandler
public void onCreate(ZoneCreateEvent e) {
e.setCancelled(true);
}Called before a zone is deleted.
Called before a zone is reloaded.
@EventHandler
public void onPreRegen(ZonePreRegenEvent e) {
if (e.getZone().countPlayersInside() > 0) {
e.setCancelled(true);
}
}Called after regeneration.
@EventHandler
public void onFlagChange(ZoneFlagChangeEvent e) {
if (e.getFlag() == ZoneFlag.PVP) {
e.setCancelled(true);
}
}✅ Allowed
- Read zone data
- Modify flags
- Trigger regeneration
- Listen to events ❌ Forbidden
- Casting API objects to internal classes
- Using fr.darklash.regensystem.core.*
- Reflection on RegenSystem internals
- Calling internal methods
Violating these rules voids compatibility guarantees.
Methods annotated with:
@ApiStatus.Internal➡️ Must never be used by addons.
Future experimental features will be located in:
fr.darklash.regensystem.api.experimental
- May change at any time
- Are not guaranteed stable
- Can be removed without notice