diff --git a/build.gradle.kts b/build.gradle.kts index 430369d..20c5ef9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,11 +3,13 @@ plugins { `java-library` `maven-publish` kotlin("jvm") version "1.7.10" - id("com.github.johnrengelman.shadow") version "7.0.0" + id("com.github.johnrengelman.shadow") version "8.0.0" + id("com.willfp.libreforge.gradle") version "1.0.0" } group = "com.willfp" version = findProperty("version")!! +val libreforgeVersion = findProperty("libreforge-version") base { archivesName.set(project.name) @@ -22,27 +24,22 @@ dependencies { allprojects { apply(plugin = "java") apply(plugin = "kotlin") + apply(plugin = "maven-publish") apply(plugin = "com.github.johnrengelman.shadow") repositories { mavenLocal() mavenCentral() + + maven("https://repo.papermc.io/repository/maven-public/") maven("https://jitpack.io") - maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") - maven("https://repo.codemc.org/repository/nms/") - maven("https://repo.codemc.org/repository/maven-public") - maven("https://repo.dmulloy2.net/nexus/repository/public/") - maven("https://papermc.io/repo/repository/maven-public/") maven("https://mvn.lumine.io/repository/maven-public/") } dependencies { - compileOnly("com.willfp:eco:6.44.0") + compileOnly("com.willfp:eco:6.53.0") compileOnly("org.jetbrains:annotations:23.0.0") compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10") - - implementation("com.willfp:libreforge:3.129.5") - implementation("org.joml:joml:1.10.4") } java { @@ -51,10 +48,13 @@ allprojects { } tasks { + shadowJar { + relocate("com.willfp.libreforge.loader", "com.willfp.ecobosses.libreforge.loader") + } + compileKotlin { kotlinOptions { jvmTarget = "17" - freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" } } @@ -66,66 +66,17 @@ allprojects { } processResources { - val ignoreList = listOf("**/*.png", "**/models/**", "**/textures/**", "**lang.yml") - filesNotMatching(ignoreList) { - expand("projectVersion" to project.version) + filesMatching(listOf("**plugin.yml", "**eco.yml")) { + expand( + "version" to project.version, + "libreforgeVersion" to libreforgeVersion, + "pluginName" to rootProject.name + ) } } build { dependsOn(shadowJar) } - - shadowJar { - relocate("com.willfp.libreforge", "com.willfp.ecobosses.libreforge") - relocate("org.joml", "com.willfp.ecobosses.libreforge.joml") - } - } -} - -tasks { - shadowJar { - destinationDirectory.set(file("$rootDir/bin")) - } - - val buyThePlugins by creating { - dependsOn(subprojects.map { it.tasks.getByName("build") }) - - doLast { - println("If you like the plugin, please consider buying it on Spigot or Polymart!") - println("Spigot: https://www.spigotmc.org/resources/authors/auxilor.507394/") - println("Polymart: https://polymart.org/user/auxilor.1107/") - println("Buying gives you access to support and the plugin auto-updater, and it allows me to keep developing plugins.") - } - } - - build { - dependsOn(shadowJar) - dependsOn(publishToMavenLocal) - finalizedBy(buyThePlugins) - } - - clean.get().doLast { file("$rootDir/bin").deleteRecursively() } - - fun fileName(extra: String): String = buildString { - append(findProperty("plugin-name")) - append(" v") - append(findProperty("version")) - if (extra.isNotEmpty()) { - append(" ") - append(extra) - } - append(".jar") - } - - shadowJar.get().archiveFileName.set(fileName("")) - jar.get().archiveFileName.set(fileName("unshaded")) -} - -publishing { - publications { - register("maven", MavenPublication::class) { - from(subprojects.first { it.name == "core-plugin" }.components["java"]) - } } } diff --git a/eco-core/core-plugin/build.gradle.kts b/eco-core/core-plugin/build.gradle.kts index f476d26..f05f36d 100644 --- a/eco-core/core-plugin/build.gradle.kts +++ b/eco-core/core-plugin/build.gradle.kts @@ -2,10 +2,21 @@ group = "com.willfp" version = rootProject.version dependencies { - compileOnly("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT") - compileOnly("net.kyori:adventure-api:4.9.3") - - // Integrations + compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT") compileOnly("com.github.lokka30:LevelledMobs:3.1.4") - compileOnly("com.ticxo.modelengine:api:R3.0.1") + compileOnly("com.ticxo.modelengine:api:R3.1.5") +} + +publishing { + publications { + register("maven", MavenPublication::class) { + from(components["java"]) + } + } +} + +tasks { + build { + dependsOn(publishToMavenLocal) + } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt index 915617c..c73a283 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/EcoBossesPlugin.kt @@ -6,7 +6,7 @@ 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.commands.CommandEcoBosses import com.willfp.ecobosses.defence.DamageMultiplierHandler import com.willfp.ecobosses.defence.ImmunitiesHandler import com.willfp.ecobosses.defence.MountHandler @@ -21,28 +21,33 @@ import com.willfp.ecobosses.spawn.SpawnEggHandler import com.willfp.ecobosses.spawn.SpawnTotemHandler import com.willfp.ecobosses.util.DiscoverRecipeListener import com.willfp.ecobosses.util.TopDamagerListener -import com.willfp.libreforge.LibReforgePlugin +import com.willfp.libreforge.loader.LibreforgePlugin +import com.willfp.libreforge.loader.configs.ConfigCategory +import com.willfp.libreforge.registerHolderProvider import org.bukkit.event.Listener -class EcoBossesPlugin : LibReforgePlugin() { +class EcoBossesPlugin : LibreforgePlugin() { init { instance = this + } + + override fun loadConfigCategories(): List { + return listOf( + Bosses + ) + } + + override fun handleEnable() { registerHolderProvider { it.bossHolders } } - override fun handleEnableAdditional() { - this.copyConfigs("bosses") - } - - override fun handleReloadAdditional() { + override fun handleReload() { Bosses.getAllAlive().forEach { it.remove() } - logger.info(Bosses.values().size.toString() + " Bosses Loaded") - AutospawnHandler.startSpawning(this) } - override fun handleDisableAdditional() { + override fun handleDisable() { Bosses.getAllAlive().forEach { it.remove() } } @@ -52,7 +57,7 @@ class EcoBossesPlugin : LibReforgePlugin() { override fun loadPluginCommands(): List { return listOf( - CommandEcobosses(this) + CommandEcoBosses(this) ) } @@ -73,7 +78,7 @@ class EcoBossesPlugin : LibReforgePlugin() { ) } - override fun loadAdditionalIntegrations(): List { + override fun loadIntegrationLoaders(): List { return listOf( IntegrationLoader("LevelledMobs") { this.eventManager.registerListener(IntegrationLevelledMobs()) } ) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/BossUtils.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/BossUtils.kt index cc9d6d2..cf211f1 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/BossUtils.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/BossUtils.kt @@ -2,15 +2,15 @@ package com.willfp.ecobosses.bosses import com.willfp.eco.core.fast.fast import com.willfp.ecobosses.EcoBossesPlugin -import com.willfp.libreforge.Holder +import com.willfp.ecobosses.util.EntityProvidedHolder import org.bukkit.entity.Player import org.bukkit.inventory.ItemStack import org.bukkit.persistence.PersistentDataType import kotlin.math.pow -val Player.bossHolders: Iterable +val Player.bossHolders: Collection get() { - val holders = mutableListOf() + val holders = mutableListOf() for (boss in Bosses.values()) { for (livingBoss in boss.getAllAlive()) { @@ -21,7 +21,7 @@ val Player.bossHolders: Iterable } if (entity.location.distanceSquared(this.location) <= boss.influence.pow(2)) { - holders.add(boss) + holders.add(EntityProvidedHolder(boss, entity)) } } } @@ -38,7 +38,7 @@ var ItemStack.bossEgg: EcoBoss? if (value == null) { pdc.remove(spawnEggKey) } else { - pdc.set(spawnEggKey, PersistentDataType.STRING, value.id) + pdc.set(spawnEggKey, PersistentDataType.STRING, value.id.key) } this.itemMeta = meta } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/Bosses.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/Bosses.kt index 0fcce45..67a35b5 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/Bosses.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/Bosses.kt @@ -1,21 +1,29 @@ package com.willfp.ecobosses.bosses -import com.google.common.collect.BiMap -import com.google.common.collect.HashBiMap import com.google.common.collect.ImmutableList import com.willfp.eco.core.config.ConfigType +import com.willfp.eco.core.config.interfaces.Config import com.willfp.eco.core.config.readConfig import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.eco.core.registry.Registry import com.willfp.ecobosses.EcoBossesPlugin +import com.willfp.libreforge.loader.LibreforgePlugin +import com.willfp.libreforge.loader.configs.ConfigCategory +import com.willfp.libreforge.loader.configs.LegacyLocation import com.willfp.libreforge.separatorAmbivalent import org.bukkit.entity.Entity import org.bukkit.entity.LivingEntity import java.io.File import java.util.UUID -object Bosses { +object Bosses : ConfigCategory("boss", "bosses") { /** Registered bosses. */ - private val BY_ID: BiMap = HashBiMap.create() + private val registry = Registry() + + override val legacyLocation = LegacyLocation( + "ecobosses.yml", + "bosses" + ) /** * Get all registered [EcoBoss]s. @@ -24,7 +32,7 @@ object Bosses { */ @JvmStatic fun values(): List { - return ImmutableList.copyOf(BY_ID.values) + return ImmutableList.copyOf(registry.values()) } /** @@ -35,52 +43,15 @@ object Bosses { */ @JvmStatic fun getByID(name: String): EcoBoss? { - return BY_ID[name] + return registry[name] } - /** - * Update all [EcoBoss]s. - * - * @param plugin Instance of EcoBosses. - */ - @ConfigUpdater - @JvmStatic - fun update(plugin: EcoBossesPlugin) { - for (boss in values()) { - removeBoss(boss) - } - - for ((id, config) in plugin.fetchConfigs("bosses")) { - addNewBoss(EcoBoss(id, config, plugin)) - } - - val ecoBossesYml = File(plugin.dataFolder, "ecobosses.yml").readConfig(ConfigType.YAML) - - for (bossConfig in ecoBossesYml.getSubsections("bosses")) { - // Boss configs are separator ambivalent in order to preserve backwards compatibility - addNewBoss(EcoBoss(bossConfig.getString("id"), bossConfig.separatorAmbivalent(), plugin)) - } + override fun clear(plugin: LibreforgePlugin) { + registry.clear() } - /** - * Add new [EcoBoss] to EcoBosses. - * - * @param set The [EcoBoss] to add. - */ - @JvmStatic - fun addNewBoss(set: EcoBoss) { - BY_ID.remove(set.id) - BY_ID[set.id] = set - } - - /** - * Remove [EcoBoss] from EcoBosses. - * - * @param set The [EcoBoss] to remove. - */ - @JvmStatic - fun removeBoss(set: EcoBoss) { - BY_ID.remove(set.id) + override fun acceptConfig(plugin: LibreforgePlugin, id: String, config: Config) { + registry.register(EcoBoss(id, config, plugin as EcoBossesPlugin)) } /** diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt index cacf951..d0f7e11 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt @@ -17,6 +17,7 @@ import com.willfp.eco.core.items.builder.ItemStackBuilder import com.willfp.eco.core.recipe.Recipes import com.willfp.eco.core.recipe.parts.EmptyTestableItem import com.willfp.eco.core.recipe.recipes.CraftingRecipe +import com.willfp.eco.core.registry.Registrable import com.willfp.eco.util.NamespacedKeyUtils import com.willfp.eco.util.toComponent import com.willfp.ecobosses.events.BossKillEvent @@ -38,6 +39,7 @@ import com.willfp.ecobosses.util.SpawnTotem import com.willfp.ecobosses.util.XpReward import com.willfp.ecobosses.util.topDamagers import com.willfp.libreforge.Holder +import com.willfp.libreforge.ViolationContext import com.willfp.libreforge.conditions.Conditions import com.willfp.libreforge.effects.Effects import net.kyori.adventure.bossbar.BossBar @@ -53,10 +55,12 @@ import java.util.Objects import java.util.UUID class EcoBoss( - override val id: String, + id: String, val config: Config, private val plugin: EcoPlugin -) : Holder { +) : Holder, Registrable { + override val id = plugin.createNamespacedKey(id) + val displayName: String = config.getString("display-name") val lifespan = config.getInt("lifespan") @@ -192,9 +196,10 @@ class EcoBoss( ConfiguredGoal(it.getInt("priority"), goal) } - val spawnConditions = config.getSubsections("spawn.conditions").mapNotNull { - Conditions.compile(it, "$id Spawn Conditions") - } + val spawnConditions = Conditions.compile( + config.getSubsections("spawn.conditions"), + ViolationContext(plugin, "$id Spawn Conditions") + ) private val bossBarColor = BossBar.Color.valueOf(config.getString("boss-bar.color").uppercase()) @@ -307,12 +312,12 @@ class EcoBoss( override val conditions = Conditions.compile( config.getSubsections("conditions"), - "Boss ID $id" + ViolationContext(plugin, "Boss ID $id") ) override val effects = Effects.compile( config.getSubsections("effects"), - "Boss ID $id" + ViolationContext(plugin, "Boss ID $id") ) fun markDead(uuid: UUID) { @@ -339,7 +344,7 @@ class EcoBoss( mob.persistentDataContainer.set( plugin.namespacedKeyFactory.create("boss"), PersistentDataType.STRING, - this.id + this.id.key ) if (hasCustomAI) { @@ -470,6 +475,10 @@ class EcoBoss( ) } + override fun getID(): String { + return this.id.key + } + override fun equals(other: Any?): Boolean { if (other !is EcoBoss) { return false diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EggDisplay.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EggDisplay.kt index eefc251..2d78db1 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EggDisplay.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EggDisplay.kt @@ -27,7 +27,7 @@ class EggDisplay( val lines = egg.spawnConditions .filterNot { it.isMet(player) } - .mapNotNull { it.notMetLines?.map { line -> Display.PREFIX + line } } + .map { it.notMetLines.map { line -> Display.PREFIX + line } } .flatten() diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandEcobosses.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandEcoBosses.kt similarity index 53% rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandEcobosses.kt rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandEcoBosses.kt index 13ef2a4..7abf9a3 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandEcobosses.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandEcoBosses.kt @@ -2,13 +2,9 @@ package com.willfp.ecobosses.commands import com.willfp.eco.core.command.impl.PluginCommand import com.willfp.ecobosses.EcoBossesPlugin -import com.willfp.ecobosses.bosses.Bosses -import com.willfp.libreforge.lrcdb.CommandExport -import com.willfp.libreforge.lrcdb.CommandImport -import com.willfp.libreforge.lrcdb.ExportableConfig import org.bukkit.command.CommandSender -class CommandEcobosses(plugin: EcoBossesPlugin) : PluginCommand( +class CommandEcoBosses(plugin: EcoBossesPlugin) : PluginCommand( plugin, "ecobosses", "ecobosses.command.ecobosses", @@ -26,14 +22,5 @@ class CommandEcobosses(plugin: EcoBossesPlugin) : PluginCommand( .addSubcommand(CommandKillall(plugin)) .addSubcommand(CommandSpawn(plugin)) .addSubcommand(CommandGive(plugin)) - .addSubcommand(CommandImport("bosses", plugin)) - .addSubcommand(CommandExport(plugin) { - Bosses.values().map { - ExportableConfig( - it.id, - it.config - ) - } - }) } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandGive.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandGive.kt index 5ad3619..fc4427c 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandGive.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandGive.kt @@ -47,7 +47,7 @@ class CommandGive(plugin: EcoPlugin) : Subcommand( } var message = plugin.langYml.getMessage("give-success") - message = message.replace("%boss%", boss.id).replace("%recipient%", reciever.name) + message = message.replace("%boss%", boss.id.key).replace("%recipient%", reciever.name) sender.sendMessage(message) val itemStack = boss.spawnEgg!! @@ -94,7 +94,7 @@ class CommandGive(plugin: EcoPlugin) : Subcommand( * The cached names. */ private val BOSS_NAMES: List - get() = Bosses.values().map { it.id } + get() = Bosses.values().map { it.id.key } /** diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt index 859c286..9c42d5a 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/commands/CommandSpawn.kt @@ -166,7 +166,7 @@ class CommandSpawn(plugin: EcoBossesPlugin) : Subcommand( * The cached names. */ private val BOSS_NAMES: List - get() = Bosses.values().map { it.id } + get() = Bosses.values().map { it.id.key } /** * The cached numbers. diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/lifecycle/ConsoleLoggers.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/lifecycle/ConsoleLoggers.kt index 9ce388f..aa1c421 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/lifecycle/ConsoleLoggers.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/lifecycle/ConsoleLoggers.kt @@ -1,15 +1,15 @@ package com.willfp.ecobosses.lifecycle +import com.willfp.eco.core.EcoPlugin import com.willfp.ecobosses.events.BossDespawnEvent import com.willfp.ecobosses.events.BossKillEvent import com.willfp.ecobosses.events.BossSpawnEvent -import com.willfp.libreforge.LibReforgePlugin import org.bukkit.event.EventHandler import org.bukkit.event.EventPriority import org.bukkit.event.Listener class ConsoleLoggers( - private val plugin: LibReforgePlugin + private val plugin: EcoPlugin ) : Listener { @EventHandler( ignoreCancelled = true, diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/spawn/SpawnEggHandler.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/spawn/SpawnEggHandler.kt index 0b6ee13..d16777a 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/spawn/SpawnEggHandler.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/spawn/SpawnEggHandler.kt @@ -3,7 +3,6 @@ package com.willfp.ecobosses.spawn import com.willfp.ecobosses.EcoBossesPlugin import com.willfp.ecobosses.bosses.bossEgg import com.willfp.ecobosses.events.BossSpawnEvent -import com.willfp.libreforge.conditions.isMet import org.bukkit.Bukkit import org.bukkit.Location import org.bukkit.block.Container @@ -79,7 +78,7 @@ class SpawnEggHandler( } if (player != null) { - if (!boss.spawnConditions.isMet(player)) { + if (!boss.spawnConditions.areMet(player)) { return false } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/spawn/SpawnTotemHandler.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/spawn/SpawnTotemHandler.kt index b6569a7..bf6a62f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/spawn/SpawnTotemHandler.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/spawn/SpawnTotemHandler.kt @@ -28,11 +28,13 @@ class SpawnTotemHandler : Listener { middle = event.block.getRelative(0, -1, 0) bottom = event.block.getRelative(0, -2, 0) } + 1 -> { top = event.block.getRelative(0, 2, 0) middle = event.block.getRelative(0, 1, 0) bottom = event.block } + 2 -> { top = event.block.getRelative(0, 1, 0) middle = event.block @@ -52,7 +54,7 @@ class SpawnTotemHandler : Listener { val player = event.player - if (!boss.spawnConditions.all { it.condition.isConditionMet(player, it.config) }) { + if (!boss.spawnConditions.areMet(player)) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/BossBarTicker.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/BossBarTicker.kt index 5a46ff1..5c4fb9d 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/BossBarTicker.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/BossBarTicker.kt @@ -14,6 +14,7 @@ class BossBarTicker( override fun tick(boss: LivingEcoBoss, tick: Int) { val entity = boss.entity + @Suppress("DEPRECATION") bar.name(entity.customName!!.toComponent()) bar.progress((entity.health / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH)!!.value).toFloat()) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/DisplayNameTicker.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/DisplayNameTicker.kt index 17c21f6..177551a 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/DisplayNameTicker.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/tick/DisplayNameTicker.kt @@ -15,6 +15,7 @@ class DisplayNameTicker : BossTicker { val formattedTime = String.format("%d:%02d", timeLeft / 60, timeLeft % 60) + @Suppress("DEPRECATION") entity.customName = boss.boss.displayName .replace("%health%", NumberUtils.format(entity.health)) .replace("%time%", formattedTime) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/util/EntityProvidedHolder.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/util/EntityProvidedHolder.kt new file mode 100644 index 0000000..e036e14 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/util/EntityProvidedHolder.kt @@ -0,0 +1,24 @@ +package com.willfp.ecobosses.util + +import com.willfp.libreforge.Holder +import com.willfp.libreforge.ProvidedHolder +import org.bukkit.entity.LivingEntity + +class EntityProvidedHolder( + override val holder: Holder, + override val item: LivingEntity +) : ProvidedHolder { + override fun equals(other: Any?): Boolean { + if (other !is EntityProvidedHolder) { + return false + } + + return other.holder == holder && other.item == item + } + + override fun hashCode(): Int { + var result = holder.hashCode() + result = 31 * result + item.hashCode() + return result + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/util/LocalBroadcast.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/util/LocalBroadcast.kt index 19ba0f4..fdf7388 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/util/LocalBroadcast.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/util/LocalBroadcast.kt @@ -38,6 +38,7 @@ data class LocalBroadcast( if (radius < 0) { for (message in toBroadcast) { + @Suppress("DEPRECATION") Bukkit.broadcastMessage(message) } } else { diff --git a/eco-core/core-plugin/src/main/resources/chains.yml b/eco-core/core-plugin/src/main/resources/chains.yml deleted file mode 100644 index 5e6a054..0000000 --- a/eco-core/core-plugin/src/main/resources/chains.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Read more about chains: https://plugins.auxilor.io/effects/configuring-an-effect#effect-chains - -chains: - - id: blind - effects: - - id: potion_effect - args: - effect: blindness - level: 3 - duration: 30 - apply_to_player: true - - id: play_sound - args: - sound: entity_dragon_fireball_explode - pitch: 1.5 - volume: 4 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index dea8d1a..0cb9810 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -8,48 +8,3 @@ log-spawn-kill: true autospawn: one-boss-per-world: true # If only one boss can auto-spawn per world at once. - -cooldown: - in-actionbar: true - sound: - enabled: true - sound: "BLOCK_NOTE_BLOCK_PLING" - pitch: 0.5 - -cannot-afford: - in-actionbar: true - sound: - enabled: true - sound: "BLOCK_NOTE_BLOCK_PLING" - pitch: 0.5 - -cannot-afford-type: - in-actionbar: true - sound: - enabled: true - sound: "BLOCK_NOTE_BLOCK_PLING" - pitch: 0.5 - -cannot-afford-price: - in-actionbar: true - sound: - enabled: true - sound: "BLOCK_NOTE_BLOCK_PLING" - pitch: 0.5 - -point-names: # If you have point names that look ugly (e.g. souls) then you can map them to nice names to be shown to players. - example_point: "Nicely Formatted Point" - -use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements -raytrace-distance: 80 # The distance that alt_click should check for a location - -potions: - icon: - permanent: true - triggered: true - ambient: - permanent: false - triggered: true - particles: - permanent: false - triggered: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/eco.yml b/eco-core/core-plugin/src/main/resources/eco.yml index 7e10e09..be43918 100644 --- a/eco-core/core-plugin/src/main/resources/eco.yml +++ b/eco-core/core-plugin/src/main/resources/eco.yml @@ -1,3 +1,8 @@ -resource-id: 525 -bstats-id: 10635 -color: "&9" \ No newline at end of file +environment: + - name: libreforge version + value: ${libreforgeVersion} + +options: + resource-id: 525 + bstats-id: 10635 + color: "&9" diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index c497083..3fb5fef 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -4,18 +4,6 @@ messages: not-player: "&cThis command must be run by a player" invalid-command: "&cUnknown subcommand!" reloaded: "Reloaded!" - cannot-afford: "&cYou can't afford to do this! &fCost: &a$$%cost%" - cannot-afford-type: "&cYou can't afford to do this! &fCost: &a%cost% %type%" - cannot-afford-price: "&cYou can't afford to do this! &fPrice: %price%" - on-cooldown: "&cThis effect is on cooldown! &fTime left: &a%seconds% seconds" - cannot-transmit: "&cYou can't transmit here!" - must-specify-lrcdb-id: "&cYou must specify the ID of the config to download! Not sure what this means? Go to &alrcdb.auxilor.io" - lrcdb-import-error: "&cError importing config: &f%message%" - lrcdb-import-success: "&fImported &a%name%&f! Reload the plugin to install it" - must-specify-config-name: "&cYou must specify the config name!" - invalid-config-name: "&cInvalid config name!" - lrcdb-export-error: "&cError exporting config: &f%message%" - lrcdb-export-success: "&fExported &a%name%&f! View it on &alrcdb.auxilor.io&f, or share your config ID: &f%id%" sent-drop: "Check console for the drop!" specify-boss: "&cYou must specify a valid boss!" diff --git a/eco-core/core-plugin/src/main/resources/lrcdb.yml b/eco-core/core-plugin/src/main/resources/lrcdb.yml deleted file mode 100644 index ddddd4f..0000000 --- a/eco-core/core-plugin/src/main/resources/lrcdb.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Options for lrcdb (https://lrcdb.auxilor.io), a website to share configs -# with other server owners, so you can get more configs without making them -# yourself! - -author: "Unknown Author" # The name attached to configs you export - -# Options about automatically sharing configs you create -share-configs: - # If you want all your configs to automatically be publicly available, - # set this to true. This really helps out other users! - publicly: false - - # If you don't want your configs to be usable to gather information about - # plugin usage or to improve the plugins in the future, disable this. - # Nothing identifying is shared. - enabled: true - -# If you disable share-configs, you can still share select configs publicly -# with /ecobosses export . \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/paper-plugin.yml b/eco-core/core-plugin/src/main/resources/paper-plugin.yml new file mode 100644 index 0000000..74d90d8 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/paper-plugin.yml @@ -0,0 +1,17 @@ +name: ${pluginName} +version: ${version} +main: com.willfp.ecobosses.EcoBossesPlugin +api-version: 1.19 + +dependencies: + - name: eco + required: true + bootstrap: false + + - name: libreforge + required: false + bootstrap: false + +load-after: + - name: eco + bootstrap: false diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml index 953e089..db8a1f9 100644 --- a/eco-core/core-plugin/src/main/resources/plugin.yml +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ -name: EcoBosses -version: ${projectVersion} +name: ${pluginName} +version: ${version} main: com.willfp.ecobosses.EcoBossesPlugin api-version: 1.17 authors: [Auxilor] @@ -7,20 +7,9 @@ website: willfp.com depend: - eco softdepend: + - libreforge - LevelledMobs - AureliumSkills - - Jobs - - mcMMO - - Vault - - TMMobcoins - - EcoEnchants - - Talismans - - EcoArmor - - EcoItems - - EcoSkills - - Boosters - - ModelEngine - - EcoJobs commands: ecobosses: @@ -41,8 +30,6 @@ permissions: ecobosses.command.reload: true ecobosses.command.spawn: true ecobosses.command.give: true - ecobosses.command.import: true - ecobosses.command.export: true ecobosses.command.ecobosses: description: Allows the use of /ecobosses @@ -63,11 +50,3 @@ permissions: ecobosses.command.reload: description: Allows the use of /ecobosses reload default: op - - ecobosses.command.import: - description: Allows the use of /ecobosses import - default: op - - ecobosses.command.export: - description: Allows the use of /ecobosses export - default: op \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index f36f604..67995d0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,5 @@ #libreforge-updater -#Mon Mar 13 13:40:30 GMT 2023 -version=8.115.6 -plugin-name=EcoBosses +#Mon Mar 13 13:39:16 GMT 2023 +kotlin.code.style=official +libreforge-version=4.0.0 +version=9.0.0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..41d9927 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..e1bef7e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 82d44d0..0000000 --- a/settings.gradle +++ /dev/null @@ -1,12 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - maven { url "https://repo.jpenilla.xyz/snapshots/" } - } -} - -rootProject.name = 'EcoBosses' - -// Core -include ':eco-core' -include ':eco-core:core-plugin' \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..169c99f --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,14 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenLocal() + maven("https://repo.jpenilla.xyz/snapshots/") + maven("https://jitpack.io") + } +} + +rootProject.name = "EcoBosses" + +// Core +include(":eco-core") +include(":eco-core:core-plugin")