Skip to content
Leaf26 edited this page Jun 17, 2026 · 9 revisions

This page is the API reference: a flat list of the concrete entry points an addon can call. If you are new to building on LeafRTP, start at Addon development (the happy path, the dependency coordinates, and the RTPAddon / ServiceLoader lifecycle), then come back here for the per-symbol details.

!!! note "Where the introductory material lives now" The JitPack/Gradle/Maven coordinates and the platform-agnostic RTPAddon SPI walkthrough are on Addon development; the loader mechanics (where the jar goes, ServiceLoader discovery) are on Addon loading; the full extension map is on Extending RTP. This page is intentionally just the reference.

LeafRTP exposes two integration surfaces:

  • a platform-agnostic addon SPI (rtp-api + rtp-core) that runs on every platform (Bukkit/Paper/Folia, Fabric, NeoForge), and
  • a set of Bukkit events for Bukkit-family plugins.

RTPAddon entry points (reference)

From an RTPAddon's onLoad() you can:

  • register a config file (RTP.configs.putParser(...), re-register on Configs.onReload(...)),
  • contribute an async location verifier via RTPAPI.hooks().verifiers().register(coords -> ...) (the platform-neutral replacement for Region.addGlobalRegionVerifier; see ADR-026),
  • observe lifecycle via TeleportPipelineTask.teleportPostActions (the platform-neutral replacement for the Bukkit PostTeleportEvent).

A complete, commented reference lives in addons/RTP_ExampleAddon (walkthrough: Example addon).

Verifiers run asynchronously: they must not block, perform main-thread chunk I/O, or swallow exceptions (S-004 / S-005).

Bukkit Events

For Bukkit-family-only plugins, RTP fires custom Bukkit events you can listen to:

  • PlayerQueuePopEvent - when a player is selected for teleportation
  • PlayerQueuePushEvent - when a player begins waiting for a new location to generate
  • PreSetupTeleportEvent / PostSetupTeleportEvent - around selection tasks
  • PreLoadChunksEvent / PostLoadChunksEvent - around chunk preload
  • PreTeleportEvent / PostTeleportEvent - around teleportation
  • RandomSelectQueueEvent - when the plugin prepares a location asynchronously
  • TeleportCancelEvent - when a player cancels teleportation
  • TeleportCommandFailEvent / TeleportCommandSuccessEvent - command outcome
public final class OnRandomTeleport implements Listener {
    @EventHandler(priority = EventPriority.HIGHEST)
    public void onRandomTeleport(PostTeleportEvent event) {
        // runs last, after other listeners may have adjusted the destination
    }
}

Register the listener as usual: getServer().getPluginManager().registerEvents(new OnRandomTeleport(), this);

Getting a region by name

Region region = RTP.selectionAPI.getRegion("regionName");

Adding Sub-Commands

You can add a subcommand with its own permission, parameters, and logic through the bundled command framework (commands-api):

RTP.baseCommand.addSubCommand(command);

Parameter decoding is automated. See the commands-api author guide and the command sources.

Clone this wiki locally