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

Compare commits

...

98 Commits

Author SHA1 Message Date
Auxilor
00c5ead347 libreforge-updater 2022-08-05 18:41:40 +01:00
Auxilor
9bd501dfbe libreforge-updater 2022-08-05 18:39:49 +01:00
Auxilor
67d55bbdc2 libreforge-updater 2022-08-04 13:03:36 +01:00
Auxilor
46aa086366 lang 2022-08-04 12:38:01 +01:00
Auxilor
9f00334ea4 lang 2022-08-04 12:31:24 +01:00
Auxilor
e6db159bfb libreforge-updater 2022-08-04 12:26:42 +01:00
Auxilor
3df7b75737 libreforge-updater 2022-08-04 12:24:14 +01:00
Auxilor
c243a425b3 libreforge-updater 2022-08-02 16:26:52 +01:00
Auxilor
e57fe61d22 libreforge-updater 2022-08-02 16:21:24 +01:00
Auxilor
9830aed484 libreforge-updater 2022-08-02 16:16:46 +01:00
Auxilor
999b89bcb0 libreforge-updater 2022-08-01 11:19:06 +01:00
Auxilor
e7f326efbb libreforge-updater 2022-07-29 17:50:41 +01:00
Auxilor
0cb5b0b7b7 libreforge-updater 2022-07-27 20:17:09 +01:00
Auxilor
8e2d901e9b Updated to 8.63.2 2022-07-26 14:41:50 +01:00
Auxilor
724eede36e Fixed boss death tracking 2022-07-26 14:41:22 +01:00
Auxilor
01a2cc7118 libreforge-updater 2022-07-25 17:53:55 +01:00
Auxilor
20aace3727 libreforge-updater 2022-07-25 17:02:32 +01:00
Auxilor
ec9d4c0dd6 libreforge-updater 2022-07-24 22:49:25 +01:00
Auxilor
b3a0c1fa67 libreforge-updater 2022-07-24 21:50:54 +01:00
Auxilor
88294a17cd libreforge-updater 2022-07-23 17:42:53 +01:00
Auxilor
1ac6a350ec libreforge-updater 2022-07-22 14:20:45 +01:00
Auxilor
a9333cb8b5 libreforge-updater 2022-07-21 20:14:10 +01:00
Auxilor
23085e74e2 Codestyle 2022-07-21 15:48:46 +01:00
Auxilor
80f02a07a4 Updated to 8.60.1 2022-07-21 15:48:22 +01:00
Will FP
a63625593d Merge pull request #45 from grzybeek/chunkticker
Fix spawning bosses on unloaded chunks
2022-07-21 15:26:05 +01:00
Auxilor
1dfd7bac1f libreforge-updater 2022-07-20 00:10:12 +01:00
Auxilor
34b983b185 libreforge-updater 2022-07-13 21:22:38 +01:00
Auxilor
33b2fd9e13 libreforge-updater 2022-07-12 14:58:43 +01:00
Auxilor
85cfb542dc libreforge-updater 2022-07-11 16:16:12 +01:00
Auxilor
197f9e91aa libreforge-updater 2022-07-09 12:10:35 +01:00
grzybeek
9d4a91805a Fix spawning bosses on unloaded chunks, keep them loaded and remove afterwards
Entity is no longer null, change not needed "?: return"
2022-07-06 02:06:46 +02:00
Auxilor
87b91c46d1 libreforge-updater 2022-07-05 18:32:14 +01:00
Auxilor
4a7e6e9ff1 libreforge-updater 2022-07-04 18:45:14 +01:00
Auxilor
b59e54be01 libreforge-updater 2022-06-30 22:54:36 +01:00
Auxilor
d26f0294cc libreforge-updater 2022-06-30 22:34:13 +01:00
Auxilor
150433d46b libreforge-updater 2022-06-26 13:03:03 +01:00
Auxilor
7de4d75c93 libreforge-updater 2022-06-25 22:22:48 +01:00
Auxilor
9790459a26 libreforge-updater 2022-06-24 13:57:52 +01:00
Auxilor
666a80b401 libreforge-updater 2022-06-22 22:24:46 +01:00
Auxilor
59810059aa libreforge-updater 2022-06-22 12:42:49 +01:00
Auxilor
7b604c7812 libreforge-updater 2022-06-21 08:29:23 +01:00
Auxilor
81eab18e42 libreforge-updater 2022-06-20 21:37:23 +01:00
Auxilor
fa54c7022b libreforge-updater 2022-06-20 14:16:54 +01:00
Auxilor
26f976a7ca libreforge-updater 2022-06-19 12:17:53 +01:00
Auxilor
4fa070dabe libreforge-updater 2022-06-18 12:19:23 +01:00
Auxilor
f73327b204 libreforge-updater 2022-06-17 21:34:43 +01:00
Auxilor
d9b702f2f1 libreforge-updater 2022-06-17 15:26:14 +01:00
Auxilor
7692e84a60 libreforge-updater 2022-06-16 16:42:42 +01:00
Auxilor
ffd6037e73 libreforge-updater 2022-06-15 15:12:17 +01:00
Auxilor
7c959d7221 libreforge-updater 2022-06-15 15:10:33 +01:00
Auxilor
91ad33334d libreforge-updater 2022-06-14 16:43:25 +01:00
Auxilor
c1b8ed5b48 libreforge-updater 2022-06-14 09:10:39 +01:00
Auxilor
2f3c5f60a4 libreforge-updater 2022-06-13 11:46:17 +01:00
Auxilor
f3387668e6 Fixed softdepends 2022-06-12 19:12:02 +01:00
Auxilor
b62e79d904 libreforge-updater 2022-06-11 11:14:57 +01:00
Auxilor
d7afeecc27 libreforge-updater 2022-06-08 21:05:47 +01:00
Auxilor
72e61940c5 libreforge-updater 2022-06-06 13:29:09 +01:00
Auxilor
245445473b libreforge-updater 2022-06-04 13:43:57 +01:00
Auxilor
46772ac97a libreforge-updater 2022-06-03 11:35:24 +01:00
Auxilor
29a1e541a2 libreforge-updater 2022-05-31 19:44:47 +01:00
Auxilor
89a6bc97b7 libreforge-updater 2022-05-30 17:04:30 +01:00
Auxilor
c59707e6ac libreforge-updater 2022-05-30 11:10:33 +01:00
Auxilor
99bc2a04ab Updated libreforge 2022-05-28 18:18:27 +01:00
Auxilor
b4e90d9bda libreforge-updater 2022-05-27 19:24:47 +01:00
Auxilor
72c3722429 libreforge-updater 2022-05-25 10:56:28 +01:00
Auxilor
c14b2f0a80 libreforge-updater 2022-05-23 16:02:39 +01:00
Auxilor
0b6c7152e8 libreforge-updater 2022-05-22 20:42:16 +01:00
Auxilor
6e551eeaeb libreforge-updater 2022-05-22 15:26:56 +01:00
Auxilor
d5610ae804 libreforge-updater 2022-05-21 17:33:43 +01:00
Auxilor
79c8ed4992 libreforge-updater 2022-05-20 18:37:00 +01:00
Auxilor
947a0f3c6d libreforge-updater 2022-05-20 18:35:57 +01:00
Auxilor
ce8b0af155 libreforge-updater 2022-05-20 18:27:10 +01:00
Auxilor
a41e5b702d libreforge-updater 2022-05-20 14:20:17 +01:00
Auxilor
f04bf3aeea libreforge-updater 2022-05-19 20:40:35 +01:00
Auxilor
08941461c9 Fixed egg display 2022-05-18 18:06:46 +01:00
Auxilor
743dbac656 Fixed egg display 2022-05-18 18:04:37 +01:00
Auxilor
2e8d1ea4cc Updated to 8.31.1 2022-05-18 17:21:43 +01:00
Auxilor
d31a98fd99 Boss eggs now display not met lore 2022-05-18 17:21:35 +01:00
Auxilor
f7244a7d7f libreforge-updater 2022-05-18 15:31:12 +01:00
Auxilor
268ed76951 libreforge-updater 2022-05-17 18:52:57 +01:00
Auxilor
d0ccb78c17 libreforge-updater 2022-05-16 21:44:52 +01:00
Auxilor
34de040849 libreforge-updater 2022-05-15 14:27:53 +01:00
Auxilor
6b01f8e64a libreforge-updater 2022-05-15 13:59:09 +01:00
Auxilor
2a4d5a8fd2 "libreforge-updater" 2022-05-15 13:33:50 +01:00
Auxilor
f9d7315fd3 Updated libreforge 2022-05-14 21:24:56 +01:00
Auxilor
497f42ccc6 Updated libreforge 2022-05-14 12:22:43 +01:00
Auxilor
d149eb7907 Updated libreforge 2022-05-13 16:02:22 +01:00
Auxilor
47277d0dd8 Updated libreforge 2022-05-12 17:24:02 +01:00
Auxilor
f307f13d1e Updated libreforge 2022-05-11 15:28:48 +01:00
Auxilor
ac3370c0be Updated libreforge 2022-05-05 21:29:00 +01:00
Auxilor
4f616ac8c8 Updated libreforge 2022-05-03 18:46:03 +01:00
Auxilor
24256e9789 Updated libreforge 2022-05-01 17:39:49 +01:00
Auxilor
bbf20e77d0 Updated libreforge 2022-04-30 11:33:18 +01:00
Auxilor
8a506c015b Updated libreforge 2022-04-29 10:20:15 +01:00
Auxilor
744883630d Updated libreforge 2022-04-27 19:00:00 +01:00
Auxilor
8519f4fc23 Updated libreforge 2022-04-27 18:58:32 +01:00
Auxilor
d1cb11ef79 Updated libreforge 2022-04-27 10:38:05 +01:00
Auxilor
edcc185b58 Updated to 8.20.4 2022-04-24 19:08:24 +01:00
21 changed files with 134 additions and 46 deletions

View File

@@ -4,7 +4,7 @@ buildscript {
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
}
}
@@ -58,15 +58,17 @@ allprojects {
shadowJar {
relocate('com.willfp.libreforge', 'com.willfp.ecobosses.libreforge')
relocate('org.joml', 'com.willfp.ecobosses.libreforge.joml')
}
dependencies {
compileOnly 'com.willfp:eco:6.34.0'
implementation 'com.willfp:libreforge:3.34.1'
compileOnly 'com.willfp:eco:6.35.1'
implementation 'com.willfp:libreforge:3.82.0'
implementation 'org.joml:joml:1.10.4'
compileOnly 'org.jetbrains:annotations:23.0.0'
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.6.21'
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.7.10'
}
tasks.withType(JavaCompile) {
@@ -130,4 +132,4 @@ task buyThePlugins {
println 'Buying gives you access to support and the plugin auto-updater, and it allows me to keep developing plugins.'
}
}
build.finalizedBy buyThePlugins
build.finalizedBy buyThePlugins

View File

@@ -1,2 +1,2 @@
group 'com.willfp'
version rootProject.version
version rootProject.version

View File

@@ -1,8 +1,10 @@
package com.willfp.ecobosses
import com.willfp.eco.core.command.impl.PluginCommand
import com.willfp.eco.core.display.DisplayModule
import com.willfp.eco.core.integrations.IntegrationLoader
import com.willfp.ecobosses.bosses.Bosses
import com.willfp.ecobosses.bosses.EggDisplay
import com.willfp.ecobosses.bosses.bossHolders
import com.willfp.ecobosses.commands.CommandEcobosses
import com.willfp.ecobosses.config.EcoBossesYml
@@ -23,7 +25,7 @@ import com.willfp.ecobosses.util.TopDamagerListener
import com.willfp.libreforge.LibReforgePlugin
import org.bukkit.event.Listener
class EcoBossesPlugin : LibReforgePlugin(525, 10635, "&9") {
class EcoBossesPlugin : LibReforgePlugin() {
val ecoBossesYml: EcoBossesYml
init {
@@ -44,6 +46,10 @@ class EcoBossesPlugin : LibReforgePlugin(525, 10635, "&9") {
Bosses.getAllAlive().forEach { it.remove() }
}
override fun createDisplayModule(): DisplayModule {
return EggDisplay(this)
}
override fun loadPluginCommands(): List<PluginCommand> {
return listOf(
CommandEcobosses(this)
@@ -74,7 +80,7 @@ class EcoBossesPlugin : LibReforgePlugin(525, 10635, "&9") {
}
override fun getMinimumEcoVersion(): String {
return "6.24.0"
return "6.35.1"
}
companion object {

View File

@@ -1,5 +1,6 @@
package com.willfp.ecobosses.bosses
import com.willfp.eco.core.fast.fast
import com.willfp.ecobosses.EcoBossesPlugin
import com.willfp.libreforge.Holder
import org.bukkit.entity.Player
@@ -13,7 +14,7 @@ val Player.bossHolders: Iterable<Holder>
for (boss in Bosses.values()) {
for (livingBoss in boss.getAllAlive()) {
val entity = livingBoss.entity ?: continue
val entity = livingBoss.entity
if (entity.world != this.world) {
continue
@@ -42,8 +43,7 @@ var ItemStack.bossEgg: EcoBoss?
this.itemMeta = meta
}
get() {
val meta = this.itemMeta ?: return null
val pdc = meta.persistentDataContainer
val pdc = this.fast().persistentDataContainer
val id = pdc.get(spawnEggKey, PersistentDataType.STRING) ?: return null
return Bosses.getByID(id)
}

View File

@@ -36,7 +36,7 @@ class EcoBoss(
val config: Config,
private val plugin: EcoPlugin
) : Holder {
val id: String = config.getString("id")
override val id: String = config.getString("id")
val displayName: String = config.getString("displayName")
@@ -332,7 +332,7 @@ class EcoBoss(
val boss = LivingEcoBoss(
plugin,
mob.uniqueId,
mob,
this,
createTickers()
)
@@ -345,7 +345,8 @@ class EcoBoss(
LifespanTicker(),
DisplayNameTicker(),
TargetTicker(),
TeleportHandler()
TeleportHandler(),
ChunkTicker()
)
if (isBossBarEnabled) {
@@ -371,7 +372,7 @@ class EcoBoss(
}
fun processRewards(event: BossKillEvent) {
val entity = event.boss.entity ?: return
val entity = event.boss.entity
val location = entity.location
val player = event.killer

View File

@@ -0,0 +1,41 @@
package com.willfp.ecobosses.bosses
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.display.Display
import com.willfp.eco.core.display.DisplayModule
import com.willfp.eco.core.display.DisplayPriority
import com.willfp.eco.core.fast.fast
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
class EggDisplay(
plugin: EcoPlugin
) : DisplayModule(
plugin,
DisplayPriority.LOW
) {
override fun display(itemStack: ItemStack, player: Player?, vararg args: Any) {
if (player == null) {
return
}
val fis = itemStack.fast()
val lore = fis.lore.toMutableList()
val egg = itemStack.bossEgg ?: return
val lines = egg.spawnConditions
.filterNot { it.isMet(player) }
.mapNotNull { it.notMetLines?.map { line -> Display.PREFIX + line } }
.flatten()
if (lines.isNotEmpty()) {
lore.add(Display.PREFIX)
lore.addAll(lines)
}
fis.lore = lore
}
}

View File

@@ -2,13 +2,12 @@ package com.willfp.ecobosses.bosses
import com.willfp.eco.core.EcoPlugin
import com.willfp.ecobosses.tick.BossTicker
import org.bukkit.Bukkit
import org.bukkit.Chunk
import org.bukkit.entity.Mob
import java.util.UUID
class LivingEcoBoss(
plugin: EcoPlugin,
private val uuid: UUID,
private val mob: Mob,
val boss: EcoBoss,
private val tickers: Set<BossTicker>
) {
@@ -18,15 +17,20 @@ class LivingEcoBoss(
}
}.apply { runTaskTimer(1, 1) }
val entity: Mob?
get() = Bukkit.getEntity(uuid) as? Mob
val entity: Mob
get() = mob
val chunk: Chunk
get() = entity.location.chunk
val forceLoadedChunks = mutableListOf<Chunk>()
val deathTime = System.currentTimeMillis() + (boss.lifespan * 1000)
private var currentTick = 1 // Start at 1 as 0 is divisible by everything
private fun tick(): Boolean {
if (entity == null || entity?.isDead == true) {
if (entity.isDead) {
remove()
return true
}
@@ -40,13 +44,15 @@ class LivingEcoBoss(
fun remove() {
ticker.cancel()
entity?.remove()
entity.remove()
tickers.forEach { it.onDeath(this, currentTick) }
forceLoadedChunks.forEach { it.isForceLoaded = false }
forceLoadedChunks.clear()
boss.markDead(uuid)
boss.markDead(mob.uniqueId)
}
override fun toString(): String {
return "LivingEcoBoss{boss=${boss}, uuid=${uuid}}"
return "LivingEcoBoss{boss=${boss}, uuid=${mob.uniqueId}}"
}
}

View File

@@ -17,7 +17,7 @@ class TargetMode(
}
fun getTarget(boss: LivingEcoBoss): LivingEntity? {
val entity = boss.entity ?: return null
val entity = boss.entity
return function(
entity.getNearbyEntities(

View File

@@ -34,8 +34,8 @@ class ConsoleLoggers(
return
}
val loc = event.boss.entity?.location
val location = "${loc?.world?.name}: ${loc?.x}, ${loc?.y}, ${loc?.z}"
val loc = event.boss.entity.location
val location = "${loc.world?.name}: ${loc.x}, ${loc.y}, ${loc.z}"
plugin.logger.info("&a${event.boss.boss.id}&r was killed by &a${event.killer?.name}&r at &a$location")
}
@@ -48,8 +48,8 @@ class ConsoleLoggers(
if (!plugin.configYml.getBool("log-spawn-kill")) {
return
}
val loc = event.boss.entity?.location
val location = "${loc?.world?.name}: ${loc?.x}, ${loc?.y}, ${loc?.z}"
val loc = event.boss.entity.location
val location = "${loc.world?.name}: ${loc.x}, ${loc.y}, ${loc.z}"
plugin.logger.info("&a${event.boss.boss.id}&r despawned at &a$location")
}

View File

@@ -1,11 +1,12 @@
package com.willfp.ecobosses.lifecycle
import com.willfp.eco.core.events.EntityDeathByEntityEvent
import com.willfp.eco.util.tryAsPlayer
import com.willfp.ecobosses.bosses.Bosses
import com.willfp.ecobosses.events.BossKillEvent
import com.willfp.libreforge.tryAsPlayer
import org.bukkit.Bukkit
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import org.bukkit.event.entity.EntityDeathEvent
@@ -25,7 +26,8 @@ class DeathListeners : Listener {
}
@EventHandler(
ignoreCancelled = true
ignoreCancelled = true,
priority = EventPriority.HIGHEST
)
fun handle(event: EntityDeathEvent) {
val boss = Bosses[event.entity] ?: return

View File

@@ -28,7 +28,7 @@ class LifecycleHandlers : Listener {
priority = EventPriority.MONITOR
)
fun handle(event: BossKillEvent) {
val entity = event.boss.entity ?: return
val entity = event.boss.entity
event.boss.boss.handleLifecycle(BossLifecycle.KILL, entity.location, entity)
}
@@ -38,7 +38,7 @@ class LifecycleHandlers : Listener {
priority = EventPriority.MONITOR
)
fun handle(event: BossDespawnEvent) {
val entity = event.boss.entity ?: return
val entity = event.boss.entity
event.boss.boss.handleLifecycle(BossLifecycle.DESPAWN, entity.location, entity)
}

View File

@@ -12,7 +12,7 @@ class BossBarTicker(
private val bar: BossBar
) : BossTicker {
override fun tick(boss: LivingEcoBoss, tick: Int) {
val entity = boss.entity ?: return
val entity = boss.entity
bar.name(entity.customName!!.toComponent())
bar.progress((entity.health / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH)!!.value).toFloat())

View File

@@ -0,0 +1,21 @@
package com.willfp.ecobosses.tick
import com.willfp.ecobosses.bosses.LivingEcoBoss
class ChunkTicker : BossTicker {
override fun tick(boss: LivingEcoBoss, tick: Int) {
val currentChunk = boss.chunk
if (tick % 10 != 0) {
return
}
if (currentChunk.isLoaded && currentChunk.isForceLoaded) {
return;
}
currentChunk.load()
currentChunk.isForceLoaded = true
boss.forceLoadedChunks.add(currentChunk)
}
}

View File

@@ -7,7 +7,7 @@ import kotlin.math.ceil
class DisplayNameTicker : BossTicker {
override fun tick(boss: LivingEcoBoss, tick: Int) {
val entity = boss.entity ?: return
val entity = boss.entity
val timeLeft = ceil(
(boss.deathTime - System.currentTimeMillis()) / 1000.0

View File

@@ -16,7 +16,7 @@ class LifespanTicker : BossTicker {
boss.remove()
boss.boss.handleLifecycle(
BossLifecycle.DESPAWN,
boss.entity?.location ?: return,
boss.entity.location,
boss.entity
)
}

View File

@@ -4,7 +4,7 @@ import com.willfp.ecobosses.bosses.LivingEcoBoss
class TargetTicker : BossTicker {
override fun tick(boss: LivingEcoBoss, tick: Int) {
val entity = boss.entity ?: return
val entity = boss.entity
if (tick % 10 != 0) {
return

View File

@@ -7,7 +7,7 @@ import org.bukkit.block.BlockFace
class TeleportHandler : BossTicker {
override fun tick(boss: LivingEcoBoss, tick: Int) {
val entity = boss.entity ?: return
val entity = boss.entity
if (!boss.boss.canTeleport) {
return
}

View File

@@ -1,13 +1,13 @@
package com.willfp.ecobosses.util
import com.willfp.eco.util.tryAsPlayer
import com.willfp.ecobosses.EcoBossesPlugin
import com.willfp.libreforge.tryAsPlayer
import org.bukkit.entity.LivingEntity
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import org.bukkit.event.entity.EntityDamageByEntityEvent
import java.util.UUID
import java.util.*
data class Damager(
val uuid: UUID,

View File

@@ -0,0 +1,3 @@
resource-id: 525
bstats-id: 10635
color: "&9"

View File

@@ -1,7 +1,7 @@
name: EcoBosses
version: ${projectVersion}
main: com.willfp.ecobosses.EcoBossesPlugin
api-version: 1.16
api-version: 1.17
authors: [Auxilor]
website: willfp.com
load: STARTUP
@@ -9,13 +9,17 @@ depend:
- eco
softdepend:
- LevelledMobs
- EcoSkills
- AureliumSkills
- Jobs
- mcMMO
- Vault
- ShopGUIPlus
- DeluxeSellwands
- TMMobcoins
- EcoEnchants
- Talismans
- EcoArmor
- EcoItems
- EcoSkills
- Boosters
commands:
ecobosses:

View File

@@ -1,2 +1,4 @@
version = 8.21.1
plugin-name = EcoBosses
#libreforge-updater
#Fri Aug 05 18:41:40 BST 2022
version=8.67.0
plugin-name=EcoBosses