Skip to content

Commit

Permalink
Updated tags
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jul 20, 2024
1 parent 438ae73 commit eb9daff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit eb9daff

Please sign in to comment.