Skip to content

Using the API

Nik edited this page Oct 11, 2026 · 1 revision

CrazyBosses API

The public API of CrazyBosses. Register your own bosses and abilities, and listen to the boss events.

Setup

Add the API as a provided dependency and make your plugin depend on CrazyBosses.

<dependency>
    <groupId>me.nik</groupId>
    <artifactId>crazybosses-api</artifactId>
    <version>1.0.0</version>
    <scope>provided</scope>
</dependency>
depend: [ CrazyBosses ]

Getting the API

CrazyBossesAPI api = CrazyBossesAPIProvider.getAPI();

Creating an ability

Extend AbilityType. The name is what bosses use in their abilities section, it is how the ability is saved to the boss files.

public class Poison extends AbilityType {

    public Poison() {
        super("POISON", "Poison Cloud", Material.SPIDER_EYE, "Poisons the players around the boss", 15, 12.0);
    }

    @Override
    public void execute(LivingEntity entity, Boss boss, AbilitySettings settings, List<Player> targets) {

        for (Player target : targets) {
            target.addPotionEffect(new PotionEffect(PotionEffectType.POISON, settings.getInt("duration", 100), 1));
        }
    }
}

AbilitySettings also has the interval, radius, amount and minion type, plus your own options through getInt, getDouble, getBoolean, getString and setOption. They are saved to the boss files and createDefaults() can be overridden to set the default ones.

Registering

api.registerAbility(new Poison());

Boss boss = new Boss("poison_king");
boss.setDisplayName("&2&lPoison King");
boss.setEntityType(EntityType.SPIDER);
boss.setHealth(300.0);
boss.addAbility(new Poison());
boss.getCommands().add("[100] give %player% minecraft:diamond 3");

api.registerBoss(boss);

Registered bosses are not saved to the bosses folder, register them every time your plugin enables. They show up in the Creator GUI, the commands, boss eggs and the random spawns like any other boss.

Other methods

LivingEntity entity = api.spawnBoss(boss, location);
boolean isBoss = api.isBoss(entity);
Boss definition = api.getBoss(entity);
ItemStack egg = api.createEgg(boss, 1);
api.unregisterBoss("poison_king");

Clone this wiki locally