From eb9daff50f1fc79360d9791c29fd0dc2676ded09 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 20 Jul 2024 15:29:54 +0100 Subject: [PATCH] Updated tags --- .../com/willfp/talismans/TalismansPlugin.kt | 13 ++----------- .../willfp/talismans/talismans/TalismanTag.kt | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 eco-core/core-plugin/src/main/kotlin/com/willfp/talismans/talismans/TalismanTag.kt diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/talismans/TalismansPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/talismans/TalismansPlugin.kt index 67332bc..518dba3 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/talismans/TalismansPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/talismans/TalismansPlugin.kt @@ -18,6 +18,7 @@ import com.willfp.talismans.command.CommandTalismans import com.willfp.talismans.display.TalismanDisplay import com.willfp.talismans.libreforge.ConditionHasTalisman import com.willfp.talismans.libreforge.SlotTypeTalisman +import com.willfp.talismans.talismans.TalismanTag import com.willfp.talismans.talismans.Talismans import com.willfp.talismans.talismans.util.BlockPlaceListener import com.willfp.talismans.talismans.util.DiscoverRecipeListener @@ -36,17 +37,7 @@ class TalismansPlugin : LibreforgePlugin() { } override fun handleLoad() { - Items.registerTag( - object : CustomItemTag(this.createNamespacedKey("talisman")) { - override fun matches(p0: ItemStack): Boolean { - return TalismanChecks.getTalismanOnItem(p0) != null - } - - override fun getExampleItem(): ItemStack { - return Talismans.values().random().itemStack - } - } - ) + Items.registerTag(TalismanTag(this)) Conditions.register(ConditionHasTalisman) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/talismans/talismans/TalismanTag.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/talismans/talismans/TalismanTag.kt new file mode 100644 index 0000000..2a0cecc --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/talismans/talismans/TalismanTag.kt @@ -0,0 +1,16 @@ +package com.willfp.talismans.talismans + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.items.tag.CustomItemTag +import com.willfp.talismans.talismans.util.TalismanChecks +import org.bukkit.inventory.ItemStack + +class TalismanTag(plugin: EcoPlugin): CustomItemTag(plugin.createNamespacedKey("talisman")) { + override fun matches(p0: ItemStack): Boolean { + return TalismanChecks.getTalismanOnItem(p0) != null + } + + override fun getExampleItem(): ItemStack { + return Talismans.values().random().itemStack + } +}