Skip to content
unknown edited this page Nov 14, 2026 · 1 revision

🔌 API for other plugins (Paper)

On Paper, other plugins can list the bots, find the bot behind an entity and listen to the bots' events. The mods have no API yet.

Setup

ManhuntStar isn't published to a Maven repository: compile against the plugin jar and don't bundle it.

build.gradle.kts:

dependencies {
    compileOnly(files("libs/ManhuntStar-2.0.0.jar"))
}

plugin.yml:

depend: [ManhuntStar]      # or softdepend, if your plugin also works without it

dev.manhuntstar.api.ManhuntStarAPI

Method Returns
getBots() Collection<Bot>: every bot, alive or dead.
getBot(UUID botId) The bot with that ID, or null.
getBot(String name) The bot with that name (numbered name first, then the shown name), or null.
getBot(Entity entity) The bot that owns this entity, or null if it isn't a bot.
isBot(Entity entity) Whether the entity is a bot's body.

A bot's body is a vanilla Mannequin, not a Player: entity instanceof Player is false for bots. Use ManhuntStarAPI.isBot(entity) to tell them apart.

dev.manhuntstar.bot.Bot exposes, among others:

Method What
id() The bot's UUID (stable across restarts).
name() · visualName() The numbered name (Hunter2) and the shown name (Hunter).
groupName() Its group.
difficulty() BotDifficulty: EASY, MEDIUM, HARD, TERMINATOR.
progression().phase() Current phase (1–10, 12).
isAlive() · health() · maxHealth() State and health.
kills() · aggression() Kills and aggression (0–10).
target() · targetPlayerId() The player it is hunting.
brain().state() What the AI is doing (a key such as fighting, following-path, towering).

The Bot class is ManhuntStar's internal model, shared with the mods; only ManhuntStarAPI and BotEvents are meant as the stable API. Read bot state on the server thread.

Events: dev.manhuntstar.api.BotEvents

All are Bukkit events, registered with a normal @EventHandler. Every one has getBot().

Event When Cancellable Extra
BotDamageByPlayerEvent A player is about to damage a bot. Yes getPlayer(), getDamage(), setDamage(double)
BotFallDamageEvent A bot is about to take fall damage. Yes getDamage()
BotDeathEvent A bot died. No getDamageSource() (Bukkit DamageSource)
BotKilledByPlayerEvent A player killed a bot. No getPlayer()

Example

import dev.manhuntstar.api.BotEvents;
import dev.manhuntstar.api.ManhuntStarAPI;
import dev.manhuntstar.bot.Bot;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public final class HunterRewards implements Listener {

    @EventHandler
    public void onKill(BotEvents.BotKilledByPlayerEvent event) {
        Bot bot = event.getBot();
        event.getPlayer().sendMessage("You killed " + bot.visualName()
                + " (phase " + bot.progression().phase() + ")");
    }

    @EventHandler
    public void onHit(BotEvents.BotDamageByPlayerEvent event) {
        // the first phases take double damage from players
        if (event.getBot().progression().phase() <= 2) {
            event.setDamage(event.getDamage() * 2);
        }
    }

    public static long aliveHunters() {
        return ManhuntStarAPI.getBots().stream().filter(Bot::isAlive).count();
    }
}

Clone this wiki locally