From 8f12af5d49099550243c91d765dbfafb88bc9d26 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 6 Feb 2022 13:09:31 +0000 Subject: [PATCH] Fixed migration issues --- .../main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt | 4 ++-- .../kotlin/com/willfp/ecobosses/commands/CommandGive.kt | 3 +-- .../kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt | 3 +-- .../com/willfp/ecobosses/lifecycle/DeathListeners.kt | 4 ++-- .../kotlin/com/willfp/ecobosses/tick/LifespanTicker.kt | 9 +++++++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt index 2d1999a..406f3ad 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt @@ -2,7 +2,7 @@ package com.willfp.ecobosses import com.willfp.eco.core.command.impl.PluginCommand import com.willfp.eco.core.integrations.IntegrationLoader -import com.willfp.ecobosses.bosses.EcoBosses +import com.willfp.ecobosses.bosses.Bosses import com.willfp.ecobosses.bosses.bossHolders import com.willfp.ecobosses.commands.CommandEcobosses import com.willfp.ecobosses.config.EcoBossesYml @@ -31,7 +31,7 @@ class EcoBossesPlugin : LibReforgePlugin(525, 10635, "&9") { } override fun handleReloadAdditional() { - logger.info(EcoBosses.values().size.toString() + " Bosses Loaded") + logger.info(Bosses.values().size.toString() + " Bosses Loaded") AutospawnHandler.startSpawning(this) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandGive.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandGive.kt index 891dcaa..5ad3619 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandGive.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandGive.kt @@ -3,7 +3,6 @@ package com.willfp.ecobosses.commands import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.command.impl.Subcommand import com.willfp.ecobosses.bosses.Bosses -import com.willfp.ecobosses.bosses.EcoBosses import org.bukkit.Bukkit import org.bukkit.command.CommandSender import org.bukkit.entity.Player @@ -40,7 +39,7 @@ class CommandGive(plugin: EcoPlugin) : Subcommand( return } val key = args[1] - val boss = EcoBosses.getByName(key) + val boss = Bosses.getByID(key) if (boss?.spawnEgg == null) { sender.sendMessage(plugin.langYml.getMessage("invalid-boss")) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt index 9bd09b7..ecb1321 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt @@ -3,7 +3,6 @@ package com.willfp.ecobosses.commands import com.willfp.eco.core.command.impl.Subcommand import com.willfp.ecobosses.EcoBossesPlugin import com.willfp.ecobosses.bosses.Bosses -import com.willfp.ecobosses.bosses.EcoBosses import com.willfp.ecobosses.events.BossSpawnEvent import org.bukkit.Bukkit import org.bukkit.Location @@ -28,7 +27,7 @@ class CommandSpawn(plugin: EcoBossesPlugin) : Subcommand( } val bossName = args[0] - val boss = EcoBosses.getByName(bossName.lowercase()) + val boss = Bosses.getByID(bossName.lowercase()) if (boss == null) { sender.sendMessage(plugin.langYml.getMessage("specify-boss")) return diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/lifecycle/DeathListeners.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/lifecycle/DeathListeners.kt index 5e66a80..cae6499 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/lifecycle/DeathListeners.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/lifecycle/DeathListeners.kt @@ -16,7 +16,7 @@ class DeathListeners : Listener { fun handle(event: EntityDeathByEntityEvent) { val boss = Bosses[event.victim] ?: return - boss.remove(BossLifecycle.KILL) + boss.remove() val deathEvent = BossKillEvent(boss, event.killer.tryAsPlayer(), event.deathEvent) Bukkit.getPluginManager().callEvent(deathEvent) @@ -28,7 +28,7 @@ class DeathListeners : Listener { fun handle(event: EntityDeathEvent) { val boss = Bosses[event.entity] ?: return - boss.remove(BossLifecycle.KILL) + boss.remove() val deathEvent = BossKillEvent(boss, null, event) Bukkit.getPluginManager().callEvent(deathEvent) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/LifespanTicker.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/LifespanTicker.kt index dfa9e3a..f501259 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/LifespanTicker.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/LifespanTicker.kt @@ -1,14 +1,19 @@ package com.willfp.ecobosses.tick -import com.willfp.ecobosses.lifecycle.BossLifecycle import com.willfp.ecobosses.bosses.LivingEcoBoss +import com.willfp.ecobosses.lifecycle.BossLifecycle class LifespanTicker : BossTicker { override fun tick(boss: LivingEcoBoss, tick: Int) { val timeLeft = (boss.deathTime - System.currentTimeMillis()) / 1000.0 if (timeLeft <= 0) { - boss.remove(BossLifecycle.DESPAWN) + boss.remove() + boss.boss.handleLifecycle( + BossLifecycle.DESPAWN, + boss.entity?.location ?: return, + boss.entity + ) } } }