diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/display/ReforgesDisplay.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/display/ReforgesDisplay.kt index 4cb38c6..43b27a4 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/display/ReforgesDisplay.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/display/ReforgesDisplay.kt @@ -14,7 +14,6 @@ import net.kyori.adventure.text.Component import net.kyori.adventure.text.TextReplacementConfig import net.kyori.adventure.text.format.TextDecoration import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer -import org.bukkit.Material import org.bukkit.inventory.ItemStack import org.bukkit.inventory.meta.SkullMeta import org.bukkit.persistence.PersistentDataType @@ -39,25 +38,20 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin ) { val target = ReforgeTarget.getForItem(itemStack) - if (target.isEmpty() && itemStack.type != Material.PLAYER_HEAD) { - // Letting player heads through here to add the stone check + val meta = itemStack.itemMeta ?: return + + val stone = ReforgeUtils.getReforgeStone(meta) + + if (target.isEmpty() && stone == null) { return } - val meta = itemStack.itemMeta ?: return - val fastItemStack = FastItemStack.wrap(itemStack) val lore = fastItemStack.lore val reforge = ReforgeUtils.getReforge(meta) - val stone = ReforgeUtils.getReforgeStone(meta) - - if (stone == null && target.isEmpty()) { - return - } - if (reforge == null && stone == null && target != null) { if (plugin.configYml.getBool("reforge.show-reforgable")) { val addLore: MutableList = ArrayList() @@ -70,11 +64,13 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin if (stone != null) { meta.setDisplayName(stone.config.getFormattedString("stone.name")) - if (stone.config.has("stone.texture") && stone.config.getString("stone.texture").isNotEmpty()) { - SkullUtils.setSkullTexture( - meta as SkullMeta, - stone.config.getString("stone.texture") - ) + val stoneMeta = stone.stone.itemMeta + if (stoneMeta is SkullMeta) { + val stoneTexture = SkullUtils.getSkullTexture(stoneMeta) + + if (stoneTexture != null) { + SkullUtils.setSkullTexture(meta as SkullMeta, stoneTexture) + } } itemStack.itemMeta = meta val stoneLore = stone.config.getFormattedStrings("stone.lore").map { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/reforges/Reforge.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/reforges/Reforge.kt index b656c9d..e89c861 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/reforges/Reforge.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/reforges/Reforge.kt @@ -3,7 +3,8 @@ package com.willfp.reforges.reforges import com.willfp.eco.core.config.interfaces.JSONConfig import com.willfp.eco.core.display.Display import com.willfp.eco.core.items.CustomItem -import com.willfp.eco.core.items.builder.SkullBuilder +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.builder.ItemStackBuilder import com.willfp.eco.core.recipe.Recipes import com.willfp.libreforge.api.conditions.Conditions import com.willfp.libreforge.api.conditions.ConfiguredCondition @@ -41,9 +42,8 @@ class Reforge( val requiresStone = config.getBool("stone.enabled") - val stone: ItemStack = SkullBuilder().apply { + val stone: ItemStack = ItemStackBuilder(Items.lookup(config.getString("stone.item")).item).apply { if (config.getBool("stone.enabled")) { - setSkullTexture(config.getString("stone.texture")) setDisplayName(config.getFormattedString("stone.name").replace("%reforge%", name)) addLoreLines( config.getFormattedStrings("stone.lore").map { "${Display.PREFIX}${it.replace("%reforge%", name)}" }) diff --git a/eco-core/core-plugin/src/main/resources/reforges.json b/eco-core/core-plugin/src/main/resources/reforges.json index ebc389c..69a1c01 100644 --- a/eco-core/core-plugin/src/main/resources/reforges.json +++ b/eco-core/core-plugin/src/main/resources/reforges.json @@ -13,7 +13,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -39,7 +39,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -68,7 +68,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -99,7 +99,7 @@ "&7reforge menu to apply the", "Dynamic&7 reforge!" ], - "texture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmM0YTY1YzY4OWIyZDM2NDA5MTAwYTYwYzJhYjhkM2QwYTY3Y2U5NGVlYTNjMWY3YWM5NzRmZDg5MzU2OGI1ZCJ9fX0=", + "item": "player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmM0YTY1YzY4OWIyZDM2NDA5MTAwYTYwYzJhYjhkM2QwYTY3Y2U5NGVlYTNjMWY3YWM5NzRmZDg5MzU2OGI1ZCJ9fX0=", "craftable": true, "recipe": [ "air", @@ -139,7 +139,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -166,7 +166,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -194,7 +194,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -230,7 +230,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -259,7 +259,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -285,7 +285,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -312,7 +312,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -343,7 +343,7 @@ "&7reforge menu to apply the", "Rich&7 reforge!" ], - "texture": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2RjNTdjNzVhZGYzOWVjNmYwZTA5MTYwNDlkZDk2NzFlOThhOGExZTYwMDEwNGU4NGU2NDVjOTg4OTUwYmQ3In19fQ==", + "item": "player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2RjNTdjNzVhZGYzOWVjNmYwZTA5MTYwNDlkZDk2NzFlOThhOGExZTYwMDEwNGU4NGU2NDVjOTg4OTUwYmQ3In19fQ==", "craftable": true, "recipe": [ "gold_block", @@ -379,7 +379,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -405,7 +405,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -432,7 +432,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -463,7 +463,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] }, @@ -494,7 +494,7 @@ "enabled": false, "name": "", "lore": [], - "texture": "", + "item": "", "craftable": false, "recipe": [] },