mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-19 15:09:17 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a40164a03d | ||
|
|
b946346020 | ||
|
|
3753c93bf5 | ||
|
|
9d407b9dea | ||
|
|
08f8b02d22 | ||
|
|
913120e791 |
@@ -309,7 +309,7 @@ internal class ConfigDrivenEcoMob(
|
||||
{ (it as? Mob)?.ecoMob == this }
|
||||
) {
|
||||
this.spawn(it, SpawnReason.COMMAND)!!.entity
|
||||
}
|
||||
}.apply { register() }
|
||||
|
||||
/*
|
||||
----------
|
||||
@@ -353,7 +353,6 @@ internal class ConfigDrivenEcoMob(
|
||||
return trackedMobs[uuid]
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun spawn(location: Location, reason: SpawnReason): LivingMob? {
|
||||
// Call bukkit event
|
||||
val preSpawnEvent = EcoMobPreSpawnEvent(this, reason)
|
||||
@@ -364,7 +363,7 @@ internal class ConfigDrivenEcoMob(
|
||||
}
|
||||
|
||||
// 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
|
||||
entity.ecoMob = this
|
||||
|
||||
@@ -27,13 +27,13 @@ internal class LivingMobImpl(
|
||||
|
||||
if (!isAlive) {
|
||||
it.cancel()
|
||||
remove()
|
||||
handleRemove()
|
||||
}
|
||||
}
|
||||
|
||||
private var isRunning = false
|
||||
|
||||
private var tick = 1
|
||||
private var tick = 0
|
||||
|
||||
private val tickHandlers = mutableListOf<TickHandler>()
|
||||
|
||||
@@ -78,23 +78,22 @@ internal class LivingMobImpl(
|
||||
}
|
||||
|
||||
override fun kill(player: Player?) {
|
||||
remove()
|
||||
handleRemove()
|
||||
|
||||
mob.spawnDrops(entity.location, player)
|
||||
}
|
||||
|
||||
override fun despawn() {
|
||||
remove()
|
||||
entity.remove()
|
||||
handleRemove()
|
||||
|
||||
Bukkit.getPluginManager().callEvent(
|
||||
EcoMobDespawnEvent(this)
|
||||
)
|
||||
}
|
||||
|
||||
private fun remove() {
|
||||
private fun handleRemove() {
|
||||
ticker.cancel()
|
||||
|
||||
entity.remove()
|
||||
deathCallback()
|
||||
|
||||
for (handler in this.tickHandlers) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
messages:
|
||||
prefix: "&9&lEcoMobs &f» "
|
||||
prefix: "&9&lEcoMobs &8» &f"
|
||||
no-permission: "&cYou don't have permission to do this!"
|
||||
not-player: "&cThis command must be run by a player"
|
||||
invalid-command: "&cUnknown subcommand!"
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
#Sun Dec 24 14:55:22 CET 2023
|
||||
kotlin.code.style=official
|
||||
libreforge-version=4.51.0
|
||||
version=10.0.0-b2
|
||||
version=10.0.0-b1
|
||||
|
||||
Reference in New Issue
Block a user