Skip to content

Commit

Permalink
fix: find all disc materials by filtering materials with "MUSIC_DISC_…
Browse files Browse the repository at this point in the history
…*" (#61)

(cherry picked from commit db9cc3b)
  • Loading branch information
Apehum committed Jul 5, 2024
1 parent 9af116b commit bb3de50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import net.kyori.adventure.text.format.TextDecoration
import org.bukkit.Bukkit
import org.bukkit.Material
import org.bukkit.NamespacedKey
import org.bukkit.Tag
import org.bukkit.enchantments.Enchantment
import org.bukkit.inventory.*
import org.bukkit.persistence.PersistentDataType
import su.plo.voice.discs.DiscsPlugin
import su.plo.voice.discs.utils.MaterialUtil

class BurnableDiscCraft(val plugin: DiscsPlugin) {

private val groupKey = NamespacedKey(plugin, "burnable_record_craft")

fun registerRecipes() = Tag.ITEMS_MUSIC_DISCS.values.forEach { record ->
fun registerRecipes() = MaterialUtil.itemMusicDiscs.forEach { record ->
createRecipe(record).let(Bukkit::addRecipe)
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/kotlin/su/plo/voice/discs/utils/MaterialUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package su.plo.voice.discs.utils

import org.bukkit.Material

object MaterialUtil {

val itemMusicDiscs: List<Material> =
Material.values()
.filter { it.name.startsWith("MUSIC_DISC_") }
}

0 comments on commit bb3de50

Please sign in to comment.