> For the complete documentation index, see [llms.txt](https://docs.ohalee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ohalee.com/products/modern-oneblock/for-developers.md).

# For Developers

{% hint style="warning" %}
**The package was renamed** `com.ohalee.ultimateoneblock` → `com.ohalee.modernoneblock`. Plugins built against 1.0.8 need recompiling.
{% endhint %}

## Public API

`OneBlockAPI` is the supported entry point, registered with Bukkit's `ServicesManager`. There is no need to cast the plugin class or reach into static fields any more.

{% code title="OneBlockAPI" %}

```java
import com.ohalee.modernoneblock.api.OneBlockAPI;

OneBlockAPI api = Bukkit.getServicesManager().load(OneBlockAPI.class);

api.island(uuid);                    // Optional<IslandView> — the player's island
api.islandAt(location);              // Optional<IslandView> — the island containing a location
api.islandUnder(player);             // Optional<IslandView> — the island a player stands on
api.islands();                       // every loaded island
api.phases();                        // every configured phase, in progression order
api.isIslandWorld(world);
api.canBuild(player, location);      // the plugin's own protection answer
```

{% endcode %}

Everything it returns is a read-only view: `IslandView`, `MemberView` and `PhaseView`, in `com.ohalee.modernoneblock.api.view`.

`IslandManager`, `GeneratorManager`, `PlayerManager` and `ProtectionService` are registered with the `ServicesManager` too, and are loaded the same way.

## Events

Modern OneBlock fires custom Bukkit events under `com.ohalee.modernoneblock.api.event`. Register a normal Bukkit `Listener` to handle them.

```java
com.ohalee.modernoneblock.api.event.GeneratorDestroyEvent
com.ohalee.modernoneblock.api.event.GeneratorPlaceEvent
com.ohalee.modernoneblock.api.event.IslandDeleteEvent
com.ohalee.modernoneblock.api.event.NewPhaseEvent
com.ohalee.modernoneblock.api.event.PlayerFlyEvent
com.ohalee.modernoneblock.api.event.PlayerIslandEnterEvent
com.ohalee.modernoneblock.api.event.PlayerIslandLeaveEvent
com.ohalee.modernoneblock.api.event.RoleChangeEvent
```

New in 26.1.0:

```java
com.ohalee.modernoneblock.api.event.IslandCreateEvent
com.ohalee.modernoneblock.api.event.IslandLevelUpEvent
com.ohalee.modernoneblock.api.event.MemberJoinEvent
com.ohalee.modernoneblock.api.event.MemberLeaveEvent   // with a reason: LEFT, KICKED, BANNED
com.ohalee.modernoneblock.api.event.CoreBreakEvent     // cancellable
com.ohalee.modernoneblock.api.event.MemberInviteEvent  // cancellable
com.ohalee.modernoneblock.api.event.IslandVisitEvent   // cancellable
```

Only events that fire *before* the action are cancellable, and every one of those is honoured.

## Breaking API changes

* **Package renamed** — `com.ohalee.ultimateoneblock` → `com.ohalee.modernoneblock`.
* **The static manager accessors are gone.** `UltimateOneBlock.islandManager()`, `.playerManager()`, `.database()` and friends no longer exist; use `OneBlockAPI` or the `ServicesManager` entries above.
* **`IEconomy`** replaces `withdrawPlayer(Player, int)` with `isPresent`, `balance`, `has`, `withdraw`, `deposit` and `format`, all on `double`.
* **`IHologram.init`** now takes `(String id, Location location, int interval)` rather than an `Island`. `init(Island, int)` remains as a default method.
* **`StaticTask`** replaces `runTask(runnable, async)` with schedulers that say *where* work runs: `atLocation`, `forEntity`, `global` and `async` (plus their `…Later` and `…Timer` variants). On a regionised server such as Folia there is no single main thread, so this distinction is not optional.

## Provider interfaces

The `api` package also defines pluggable provider interfaces you can implement to integrate with your own systems:

* `com.ohalee.modernoneblock.api.economy.IEconomy` — economy backend. Note that `isPresent()` is false when no economy plugin is installed: callers that *charge* may proceed anyway, but callers that would *pay out* must refuse rather than create money from nothing.
* `com.ohalee.modernoneblock.api.hologram.IHologram` — hologram backend (implementations exist for HolographicDisplays, DecentHolograms, FancyHolograms and CMI).
