Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Developer Documentation

DarkLash edited this page Jan 20, 2026 · 8 revisions

API Version: 1.0.0
Compatibility: Spigot / Paper / Folia
Status: Stable

RegenSystem provides a public and stable API allowing external plugins to interact with regenerable zones, flags, and regeneration events without accessing internal code.


Installation & Dependency (JitPack)

Add JitPack repository

Gradle (Kotlin DSL)

repositories {
    maven("https://jitpack.io")
}

Gradle (Groovy)

repositories {
    maven { url 'https://jitpack.io' }
}

Maven

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

Add RegenSystem API dependency

Gradle

dependencies {
    compileOnly("com.github.DarkLashDev:RegenSystem:v2.0.2")
}

Maven

<dependency>
  <groupId>com.github.DarkLashDev</groupId>
  <artifactId>RegenSystem</artifactId>
  <version>v2.0.2</version>
  <scope>provided</scope>
</dependency>

plugin.yml

depend:
  - RegenSystem

Getting Started

if (!RegenSystemAPI.isInitialized()) {
    throw new IllegalStateException("RegenSystem API not available");
}

ZoneRegistry zones = RegenSystemAPI.getZones();

RegenSystemAPI

Central entry point of the API.

ZoneRegistry registry = RegenSystemAPI.getZones();

Versioning

RegenSystemAPI.API_VERSION
RegenSystemAPI.API_MAJOR
RegenSystemAPI.API_MINOR
RegenSystemAPI.API_PATCH

ZoneRegistry

Access and query all registered zones.

Methods

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) Time before regeneration
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);

RegenZone

Represents a regenerable area.

Core

Method Description
getName() Zone name
getCorner1() First corner
getCorner2() Second corner
getCenter() Center location
isEnabled() Enabled state
getBlockCount() Stored blocks

Logic

Method Description
contains(Location) Check if location is inside
regenerate() Trigger regeneration
countPlayersInside() Count players
RegenResult result = zone.regenerate();

Flags

boolean pvp = zone.hasFlag(ZoneFlag.PVP);
zone.setFlag(ZoneFlag.PVP, false);
Map<ZoneFlag, Boolean> flags = zone.getFlags();

Visuals

zone.highlight(Particle.VILLAGER_HAPPY, Duration.ofSeconds(5));

ZoneFlag

Available flags:

  • PVP
  • EXPLOSION
  • BLOCK_BREAK
  • BLOCK_PLACE
  • ITEM_DROP
  • ITEM_PICKUP
  • MOB_SPAWN
  • MOB_DAMAGE

Parsing:

ZoneFlag flag = ZoneFlag.fromString("bb");

RegenResult

Result Meaning
SUCCESS Regeneration done
SKIP Nothing to regenerate
STOP Cancelled or disabled
ERROR Internal error
if (result.isSuccess()) {
    // success
}

Events

ZoneCreateEvent (Cancellable)

@EventHandler
public void onCreate(ZoneCreateEvent e) {
    e.setCancelled(true);
}

ZoneDeleteEvent (Cancellable)

Called before a zone is deleted.

ZoneReloadEvent (Cancellable)

Called before a zone is reloaded.

ZonePreRegenEvent (Cancellable)

@EventHandler
public void onPreRegen(ZonePreRegenEvent e) {
    if (e.getZone().countPlayersInside() > 0) {
        e.setCancelled(true);
    }
}

ZonePostRegenEvent (Not cancellable)

Called after regeneration.

ZoneFlagChangeEvent (Cancellable)

@EventHandler
public void onFlagChange(ZoneFlagChangeEvent e) {
    if (e.getFlag() == ZoneFlag.PVP) {
        e.setCancelled(true);
    }
}

API Stability

Stable

  • fr.darklash.regensystem.api.*
  • Backward compatible inside major version

Forbidden

  • Casting to internal classes
  • Using core packages
  • Reflection on internals

Internal API

Methods annotated with:
@ApiStatus.Internal
Must not be used by addons.

Experimental API

Future experimental APIs will be placed in:
fr.darklash.regensystem.api.experimental
They may change or be removed without notice.

Clone this wiki locally