Skip to content
EncryptDev edited this page May 19, 2018 · 3 revisions

API

The API has following points:

  • Create a boss
  • Use events
  • BossManager class

Now. Create your own boss with the api:

You have 2 possibilities to create a boss.

1: You must extend from the APIBoss class. Now, you can override every method. And customize your own boss. When you extend from APIBoss then you have this constructor:

public MyBoss(BossSettings bossSettings, int livingId, String name, Location spawnLocation, EntityType type) {
    super(bossSettings, livingId, name, spawnLocation, type);
}

The BossSettings class, hold all information about the boss. You can create it manual with new BossSettings(...) or use the BossEditor where you can create the bosssettings across the code (See by my code)

2: Implement the interface IBoss, and write every method with your ideas.

When you create the boss class then use the BossManager class, for save the boss in the file and register it in the plugin. The BossManager can you get from the BossMode class. Use: BossMode.getInstance().getBossManager().createBoss(IBoss boss);

Use Events

You can choose between 4 events:

BossSpawnEvent - The BossSpawnEvent called when the boss spawn

BossDeathEvent - The BossDeathEvent called when the boss die

BossDamageEvent- The BossDamageEvent called when the boss get damage

BossUseSpecialAttackEvent - The BossUseSpecialAttackEvent called when the boss use a special attack

The BossManager class

The BossManager have useful methods.

createBossEditor(Player player, EntityType type) - create a BossEditor

createSpawnerEdtitor(Player player, IBoss iBoss) - create a SpawnerEditor

getSpawnerEditor(Player player) -get the spawner editor from the player

getBossEditor(Player player) - get the boss editor from the player

createBoss( IBoss boss, boolean edit) - create the boss, and save him into the file. (set the boolean edit to true, when you edit the boss)

createSpawner(SpawnerEditor editor) - create a spawner, from the SpawnerEditor

getSpawner(int id) - get the spawner itemstack from the boss with the id

delete(IBoss iBoss) - delete the boss and the file

copyBoss(IBoss iBoss) - copy the boss

getBoss(int bossId) - get the boss from the cache

getSpawnedBoss(int livingId) - get a spawned boss. The living id can you get from the meta data:

iBoss.getBossEntity().getMetadata(BossSettings.META_DATA_BOSS_LIVING_ID).get(0).asInt()

Clone this wiki locally