memosd79-source

Make a paladin boss

Kodari AI
KodariJul 3 at 2:10 am 13

I’ll create a Paladin Boss plugin — a powerful custom mob with holy-themed abilities (smite, healing light, charge, minion summon), boss bar health tracking, and a spawn command.

PaladinBoss
A custom boss battle plugin featuring a Paladin boss mob with holy-themed abilities: lightning smite strikes on nearby players, self-healing light, charging dashes, and minion summoning. Includes a live boss bar showing health, custom loot drops on defeat, and an admin command to spawn the boss anywhere. Built with Paper API and Kotlin.

Built with Maven (pom.xml, shaded Kotlin stdlib, no Gradle files) as requested.

  • /paladinboss spawn — spawns a Paladin Champion (buffed golden-armored zombie) at your location with a live boss bar.

  • Every 5s it randomly casts Holy Smite (lightning + AoE damage), Healing Light (self-heal + particles), or Charge (speed burst toward a target), with a chance to summon vindicator minions.

  • On death, boss bar clears and it drops custom loot (diamonds, golden/enchanted apples, netherite) defined in config.yml.

  • /paladinboss kill force-removes any active bosses (e.g. on shutdown/reload).

[Generation stopped]

memosd79-source

Show me the model

Kodari AI
KodariJul 3 at 2:12 am 6

Everything already exists as a Maven project (pom.xml, not Gradle) — the earlier response got cut off but all files landed correctly. Here’s the boss “model” — the core class defining the Paladin’s stats, appearance, and abilities:

PaladinBossManager.kt — this is the heart of the boss:

  • Spawn: spawnBoss() creates a Zombie entity, sets max health/speed/attack from config.yml, gives it a golden name via bossName, and calls equipPaladin() to gear it up — full golden armor + a Sharpness III golden sword with zero drop chance.

  • Boss bar: created per-spawn, tracked in ActivePaladinBoss (a small data class holding the entity, bar, and its repeating ability task).

  • Ability loop (runAbilityCycle, every 5s by default): randomly picks between:

    • holySmite() — strikes lightning + deals damage to all nearby players

    • healingLight() — heals itself and spawns heart particles

    • chargeTarget() — launches itself at a random nearby player with a speed boost

    • 25% chance each cycle to also summonMinions() — spawns Vindicators around it

  • Death/cleanup: removeBoss() cancels the ability task, clears the boss bar, and removes the entity.

Supporting pieces: PaladinBossListener.kt updates the boss bar on damage and handles custom loot drops on death; PaladinBossCommand.kt provides /paladinboss spawn|kill; all tunables (health, damage, heal, minions, loot table) live in config.yml.

Want me to add phase-based mechanics (e.g. enrage below 30% HP) or a cooldown-resistant shield ability?

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
8 447
src/main/kotlin/com/kodari/paladinboss/boss/PaladinBossManager.kt
package com.kodari.paladinboss.boss

import com.kodari.paladinboss.PaladinBossPlugin
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.attribute.Attribute
import org.bukkit.boss.BarColor
import org.bukkit.boss.BarStyle
import org.bukkit.enchantments.Enchantment
import org.bukkit.entity.EntityType
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Player
import org.bukkit.entity.Zombie
import org.bukkit.inventory.EquipmentSlot
import org.bukkit.inventory.ItemStack
import org.bukkit.potion.PotionEffect
import org.bukkit.potion.PotionEffectType
import org.bukkit.util.Vector
import java.util.UUID
import kotlin.random.Random

class PaladinBossManager(private val plugin: PaladinBossPlugin) {

    private val activeBosses = mutableMapOf<UUID, ActivePaladinBoss>()

    fun isPaladinBoss(entityId: UUID): Boolean = activeBosses.containsKey(entityId)

    fun getActiveBoss(entityId: UUID): ActivePaladinBoss? = activeBosses[entityId]

    fun spawnBoss(location: Location): LivingEntity {
        val config = plugin.config
        val maxHealth = config.getDouble("boss.max-health", 200.0)
        val bossName = config.getString("boss.name", "&6&lPaladin Champion")!!

        val zombie = location.world!!.spawn(location, Zombie::class.java) { entity ->
            entity.customName(net.kyori.adventure.text.Component.text(
                org.bukkit.ChatColor.translateAlternateColorCodes('&', bossName)
            ))
            entity.isCustomNameVisible = true
            entity.getAttribute(Attribute.MAX_HEALTH)?.baseValue = maxHealth
            entity.health = maxHealth
            entity.getAttribute(Attribute.MOVEMENT_SPEED)?.baseValue = 0.28
            entity.getAttribute(Attribute.ATTACK_DAMAGE)?.baseValue = 8.0
            entity.isPersistent = true
            entity.removeWhenFarAway = false
        }

        equipPaladin(zombie)

        val bossBar = plugin.server.createBossBar(
            org.bukkit.ChatColor.translateAlternateColorCodes('&', bossName),
            BarColor.WHITE,
            BarStyle.SOLID
        )
        bossBar.progress = 1.0

        val active = ActivePaladinBoss(zombie, bossBar)
        activeBosses[zombie.uniqueId] = active

        val task = plugin.server.scheduler.runTaskTimer(plugin, Runnable {
            runAbilityCycle(active)
        }, 100L, config.getLong("boss.ability-interval-ticks", 100L))
        active.abilityTask = task

        return zombie
    }

    private fun equipPaladin(zombie: Zombie) {
        val equipment = zombie.equipment ?: return
        val helmet = ItemStack(Material.GOLDEN_HELMET)
        val chestplate = ItemStack(Material.GOLDEN_CHESTPLATE)
        val leggings = ItemStack(Material.GOLDEN_LEGGINGS)
        val boots = ItemStack(Material.GOLDEN_BOOTS)
        val sword = ItemStack(Material.GOLDEN_SWORD)
        sword.addUnsafeEnchantment(Enchantment.SHARPNESS, 3)

        equipment.setItem(EquipmentSlot.HEAD, helmet)
        equipment.setItem(EquipmentSlot.CHEST, chestplate)
        equipment.setItem(EquipmentSlot.LEGS, leggings)
        equipment.setItem(EquipmentSlot.FEET, boots)
        equipment.setItem(EquipmentSlot.HAND, sword)

        equipment.setDropChance(EquipmentSlot.HEAD, 0f)
        equipment.setDropChance(EquipmentSlot.CHEST, 0f)
        equipment.setDropChance(EquipmentSlot.LEGS, 0f)
        equipment.setDropChance(EquipmentSlot.FEET, 0f)
        equipment.setDropChance(EquipmentSlot.HAND, 0f)
    }

    fun addPlayerToBossBar(entityId: UUID, player: Player) {
        activeBosses[entityId]?.bossBar?.addPlayer(player)
    }

    fun updateBossBar(entityId: UUID) {
        val active = activeBosses[entityId] ?: return
        val entity = active.entity
        val maxHealth = entity.getAttribute(Attribute.MAX_HEALTH)?.value ?: 1.0
        active.bossBar.progress = (entity.health / maxHealth).coerceIn(0.0, 1.0)
    }

    private fun runAbilityCycle(active: ActivePaladinBoss) {
        val entity = active.entity
        if (!entity.isValid || entity.isDead) {
            removeBoss(entity.uniqueId)
            return
        }

        val nearbyPlayers = entity.location.getNearbyPlayers(
            plugin.config.getDouble("boss.smite-radius", 6.0)
        ).toList()

        if (nearbyPlayers.isEmpty()) return

        when (Random.nextInt(3)) {
            0 -> holySmite(entity, nearbyPlayers)
            1 -> healingLight(entity)
            2 -> chargeTarget(entity, nearbyPlayers.random())
        }

        if (Random.nextInt(4) == 0) {
            summonMinions(entity)
        }
    }

    private fun holySmite(boss: LivingEntity, targets: List<Player>) {
        val damage = plugin.config.getDouble("boss.smite-damage", 6.0)
        for (target in targets) {
            target.world.strikeLightningEffect(target.location)
            target.damage(damage, boss)
        }
    }

    private fun healingLight(boss: LivingEntity) {
        val healAmount = plugin.config.getDouble("boss.heal-amount", 15.0)
        val maxHealth = boss.getAttribute(Attribute.MAX_HEALTH)?.value ?: boss.health
        boss.health = (boss.health + healAmount).coerceAtMost(maxHealth)
        boss.world.spawnParticle(org.bukkit.Particle.HEART, boss.location.add(0.0, 2.0, 0.0), 10)
    }

    private fun chargeTarget(boss: LivingEntity, target: Player) {
        val multiplier = plugin.config.getDouble("boss.charge-speed-multiplier", 2.5)
        val direction = target.location.toVector().subtract(boss.location.toVector()).normalize()
        boss.velocity = direction.multiply(multiplier) as Vector
        boss.addPotionEffect(PotionEffect(PotionEffectType.SPEED, 40, 1))
    }

    private fun summonMinions(boss: LivingEntity) {
        val amount = plugin.config.getInt("boss.minions-to-summon", 3)
        repeat(amount) {
            val loc = boss.location.clone().add(
                Random.nextDouble(-3.0, 3.0), 0.0, Random.nextDouble(-3.0, 3.0)
            )
            boss.world.spawnEntity(loc, EntityType.VINDICATOR)
        }
    }

    fun removeBoss(entityId: UUID) {
        val active = activeBosses.remove(entityId) ?: return
        active.abilityTask?.cancel()
        active.bossBar.removeAll()
        if (active.entity.isValid) {
            active.entity.remove()
        }
    }

    fun removeAllBosses() {
        activeBosses.keys.toList().forEach { removeBoss(it) }
    }
}