For the complete documentation index, see llms.txt. This page is also available as Markdown.

๐Ÿ–ฅ๏ธFor Developers

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.

OneBlockAPI
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

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.

New in 26.1.0:

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).

Last updated