From dddf2d8a20dbe9a0e58fa3958f01bac77225e598 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 8 Feb 2022 20:07:04 +0000 Subject: [PATCH] Added support for names without lookup string --- .../com/willfp/ecobosses/bosses/EcoBoss.kt | 26 +++++++------------ .../src/main/resources/ecobosses.yml | 3 ++- 2 files changed, 12 insertions(+), 17 deletions(-) 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 5d1eb25..dcab27f 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 @@ -14,20 +14,8 @@ import com.willfp.eco.core.recipe.recipes.CraftingRecipe import com.willfp.eco.util.toComponent import com.willfp.ecobosses.events.BossKillEvent import com.willfp.ecobosses.lifecycle.BossLifecycle -import com.willfp.ecobosses.tick.BossBarTicker -import com.willfp.ecobosses.tick.BossTicker -import com.willfp.ecobosses.tick.DisplayNameTicker -import com.willfp.ecobosses.tick.LifespanTicker -import com.willfp.ecobosses.tick.TargetTicker -import com.willfp.ecobosses.tick.TeleportHandler -import com.willfp.ecobosses.util.BossDrop -import com.willfp.ecobosses.util.CommandReward -import com.willfp.ecobosses.util.ConfiguredSound -import com.willfp.ecobosses.util.LocalBroadcast -import com.willfp.ecobosses.util.PlayableSound -import com.willfp.ecobosses.util.SpawnTotem -import com.willfp.ecobosses.util.XpReward -import com.willfp.ecobosses.util.topDamagers +import com.willfp.ecobosses.tick.* +import com.willfp.ecobosses.util.* import com.willfp.libreforge.Holder import com.willfp.libreforge.conditions.Conditions import com.willfp.libreforge.effects.Effects @@ -38,8 +26,7 @@ import org.bukkit.Material import org.bukkit.entity.LivingEntity import org.bukkit.entity.Player import org.bukkit.inventory.ItemStack -import java.util.Objects -import java.util.UUID +import java.util.* class EcoBoss( val config: Config, @@ -93,8 +80,15 @@ class EcoBoss( return@run null } + val name = config.getFormattedStringOrNull("spawn.egg.name") + val item = ItemStackBuilder(lookup) .addLoreLines(config.getFormattedStrings("spawn.egg.lore")) + .apply { + if (name != null) { + setDisplayName(name) + } + } .build().apply { bossEgg = this@EcoBoss } val key = plugin.namespacedKeyFactory.create("${this.id}_spawn_egg") diff --git a/eco-core/core-plugin/src/main/resources/ecobosses.yml b/eco-core/core-plugin/src/main/resources/ecobosses.yml index 739d98c..647c1af 100644 --- a/eco-core/core-plugin/src/main/resources/ecobosses.yml +++ b/eco-core/core-plugin/src/main/resources/ecobosses.yml @@ -106,7 +106,8 @@ bosses: notInWorlds: [ ] # If spawn totems should be disallowed in certain worlds, specify them here egg: enabled: true # If the boss should have a spawn egg - item: evoker_spawn_egg unbreaking:1 hide_enchants name:"&8Steel Golem&f Spawn Egg" + item: evoker_spawn_egg unbreaking:1 hide_enchants + name: "&8Steel Golem&f Spawn Egg" lore: - "" - "&8&oPlace on the ground to"