Skip to content

Developer API

Purdze edited this page Sep 24, 2026 · 2 revisions

Hounded fires Bukkit events that other plugins can listen to. They're all in the dev.marshall.hounded.api package and fired on the main thread.

Events

Event When Cancellable
HoundedRoundStartEvent Just before a round starts, after Hounded has checked that it can yes
HoundedRoleChangeEvent Just before a player's role changes yes
HoundedRoundWinEvent A side won no
HoundedRoundStopEvent An admin stopped the round with /hounded stop no
HoundedRoundEndEvent Parent of the win and stop events: listen to it to hear about any end no

HoundedRoundStartEvent

  • runners(), hunters(): player ids, in the order they were added. Never empty.
  • headstartSeconds(): 0 means the hunters are released at once.
  • Cancelling keeps the server in the lobby, and the admin who started the round is told another plugin cancelled it.

HoundedRoleChangeEvent

  • player(): the player's id. They may be offline when roles are cleared.
  • from(), to(): Optional<Role>. from is empty for a new role, and to is empty when the role is removed.
  • Clearing a side fires one event per player. Cancelling one keeps just that player.
  • Not fired during a round, because roles are locked then.

HoundedRoundEndEvent, HoundedRoundWinEvent, HoundedRoundStopEvent

  • runners(): every runner in the round, including eliminated ones. hunters(): every hunter.
  • huntTime(): time from the hunters' release to the end. Zero if it ended during the headstart.
  • HoundedRoundWinEvent.winner(): Role.RUNNER when the ender dragon dies, Role.HUNTER when every runner is out.
  • When these fire, the result has already been announced, and the game returns to the lobby right after.

Role is dev.marshall.hounded.game.Role (RUNNER or HUNTER).

Setup

Hounded isn't published to a Maven repository yet. Download the jar from the releases and compile against it:

// build.gradle.kts
dependencies {
    compileOnly(files("libs/hounded-1.0.0.jar"))
}

In your plugin.yml, add softdepend: [Hounded] if Hounded is optional, or depend: [Hounded] if it's required.

If Hounded is optional, only register your listener when it's enabled. Otherwise loading your listener class fails on servers without Hounded:

if (getServer().getPluginManager().isPluginEnabled("Hounded")) {
    getServer().getPluginManager().registerEvents(new ManhuntListener(), this);
}

Example

public final class ManhuntListener implements Listener {
    @EventHandler
    public void onWin(HoundedRoundWinEvent event) {
        Bukkit.getLogger().info(event.winner() + " won after " + event.huntTime().toMinutes() + " minutes");
    }

    @EventHandler
    public void onStart(HoundedRoundStartEvent event) {
        if (event.hunters().size() > 10) {
            event.setCancelled(true);
        }
    }
}

Hounded is GPL-3.0. See the license if you ship code built on it.

Clone this wiki locally