9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-19 23:19:17 +00:00

Improved spawn method

This commit is contained in:
Will FP
2023-11-28 13:41:15 +00:00
parent 393c9d62d1
commit 7c162f5565

View File

@@ -66,15 +66,16 @@ object SpawnMethodFactoryCustom : SpawnMethodFactory("custom") {
private fun tick() { private fun tick() {
for (player in Bukkit.getOnlinePlayers()) { for (player in Bukkit.getOnlinePlayers()) {
for (point in player.spawnPoints.filter { it.type in spawnTypes }) { for (point in player.spawnPoints.filter { it.type in spawnTypes }) {
if (randDouble(0.0, 100.0) > chance) { val mob = category.mobs.randomOrNull() ?: continue
continue
}
if (!conditions.areMet(point.location.toDispatcher(), EmptyProvidedHolder)) { if (!conditions.areMet(point.location.toDispatcher(), EmptyProvidedHolder)) {
continue continue
} }
val mob = category.mobs.randomOrNull() ?: continue if (randDouble(0.0, 100.0) > chance) {
continue
}
mob.spawn(point.location, SpawnReason.NATURAL) mob.spawn(point.location, SpawnReason.NATURAL)
} }
} }