From 7c162f55658664d2f68413ca04c5020114ce9f80 Mon Sep 17 00:00:00 2001 From: Will FP Date: Tue, 28 Nov 2023 13:41:15 +0000 Subject: [PATCH] Improved spawn method --- .../category/spawning/impl/SpawnMethodFactoryCustom.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecomobs/category/spawning/impl/SpawnMethodFactoryCustom.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecomobs/category/spawning/impl/SpawnMethodFactoryCustom.kt index e233dc5..46ed5d0 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecomobs/category/spawning/impl/SpawnMethodFactoryCustom.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecomobs/category/spawning/impl/SpawnMethodFactoryCustom.kt @@ -66,15 +66,16 @@ object SpawnMethodFactoryCustom : SpawnMethodFactory("custom") { private fun tick() { for (player in Bukkit.getOnlinePlayers()) { for (point in player.spawnPoints.filter { it.type in spawnTypes }) { - if (randDouble(0.0, 100.0) > chance) { - continue - } + val mob = category.mobs.randomOrNull() ?: continue if (!conditions.areMet(point.location.toDispatcher(), EmptyProvidedHolder)) { continue } - val mob = category.mobs.randomOrNull() ?: continue + if (randDouble(0.0, 100.0) > chance) { + continue + } + mob.spawn(point.location, SpawnReason.NATURAL) } }