mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-20 07:29:21 +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 }
|
{ (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
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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!"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user