9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-20 07:29:21 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Will FP
a40164a03d Fixed tickers 2023-12-28 12:48:04 +01:00
Will FP
b946346020 Fix to lang.yml 2023-12-27 18:04:26 +01:00
Will FP
3753c93bf5 Improved error message 2023-12-27 17:53:04 +01:00
Will FP
9d407b9dea Fixed death animation not playing 2023-12-27 17:47:55 +01:00
Will FP
08f8b02d22 Fixed custom entity 2023-12-26 14:19:06 +01:00
Will FP
913120e791 oops 2023-12-24 14:56:21 +01:00
4 changed files with 10 additions and 12 deletions

View File

@@ -309,7 +309,7 @@ internal class ConfigDrivenEcoMob(
{ (it as? Mob)?.ecoMob == this } { (it as? Mob)?.ecoMob == this }
) { ) {
this.spawn(it, SpawnReason.COMMAND)!!.entity this.spawn(it, SpawnReason.COMMAND)!!.entity
} }.apply { register() }
/* /*
---------- ----------
@@ -353,7 +353,6 @@ internal class ConfigDrivenEcoMob(
return trackedMobs[uuid] return trackedMobs[uuid]
} }
@Suppress("UNCHECKED_CAST")
override fun spawn(location: Location, reason: SpawnReason): LivingMob? { override fun spawn(location: Location, reason: SpawnReason): LivingMob? {
// Call bukkit event // Call bukkit event
val preSpawnEvent = EcoMobPreSpawnEvent(this, reason) val preSpawnEvent = EcoMobPreSpawnEvent(this, reason)
@@ -364,7 +363,7 @@ internal class ConfigDrivenEcoMob(
} }
// Spawn bukkit mob // Spawn bukkit mob
val entity = mob.spawn(location) as? Mob ?: throw IllegalStateException("Mob is not a mob") val entity = mob.spawn(location) as? Mob ?: throw IllegalStateException("Base entity must be a mob!")
// Mark as custom mob // Mark as custom mob
entity.ecoMob = this entity.ecoMob = this

View File

@@ -27,13 +27,13 @@ internal class LivingMobImpl(
if (!isAlive) { if (!isAlive) {
it.cancel() it.cancel()
remove() handleRemove()
} }
} }
private var isRunning = false private var isRunning = false
private var tick = 1 private var tick = 0
private val tickHandlers = mutableListOf<TickHandler>() private val tickHandlers = mutableListOf<TickHandler>()
@@ -78,23 +78,22 @@ internal class LivingMobImpl(
} }
override fun kill(player: Player?) { override fun kill(player: Player?) {
remove() handleRemove()
mob.spawnDrops(entity.location, player) mob.spawnDrops(entity.location, player)
} }
override fun despawn() { override fun despawn() {
remove() entity.remove()
handleRemove()
Bukkit.getPluginManager().callEvent( Bukkit.getPluginManager().callEvent(
EcoMobDespawnEvent(this) EcoMobDespawnEvent(this)
) )
} }
private fun remove() { private fun handleRemove() {
ticker.cancel() ticker.cancel()
entity.remove()
deathCallback() deathCallback()
for (handler in this.tickHandlers) { for (handler in this.tickHandlers) {

View File

@@ -1,5 +1,5 @@
messages: messages:
prefix: "&9&lEcoMobs &f» " prefix: "&9&lEcoMobs &8» &f"
no-permission: "&cYou don't have permission to do this!" no-permission: "&cYou don't have permission to do this!"
not-player: "&cThis command must be run by a player" not-player: "&cThis command must be run by a player"
invalid-command: "&cUnknown subcommand!" invalid-command: "&cUnknown subcommand!"

View File

@@ -2,4 +2,4 @@
#Sun Dec 24 14:55:22 CET 2023 #Sun Dec 24 14:55:22 CET 2023
kotlin.code.style=official kotlin.code.style=official
libreforge-version=4.51.0 libreforge-version=4.51.0
version=10.0.0-b2 version=10.0.0-b1