|
| 1 | +package de.kiridevs.ksmpplugin.recipes.crafting; |
| 2 | + |
| 3 | +import org.bukkit.Bukkit; |
| 4 | +import org.bukkit.Material; |
| 5 | +import org.bukkit.NamespacedKey; |
| 6 | +import org.bukkit.configuration.ConfigurationSection; |
| 7 | +import org.bukkit.inventory.ItemStack; |
| 8 | +import org.bukkit.inventory.ShapedRecipe; |
| 9 | +import org.bukkit.inventory.RecipeChoice.MaterialChoice; |
| 10 | + |
| 11 | +import de.kiridevs.ksmpplugin.main.KiriSmpPlugin; |
| 12 | + |
| 13 | +public class ShroomlightRecipe { |
| 14 | + private final KiriSmpPlugin plugin; |
| 15 | + |
| 16 | + private static final MaterialChoice SHROOM_BLOCKS = new MaterialChoice( |
| 17 | + Material.BROWN_MUSHROOM_BLOCK, |
| 18 | + Material.RED_MUSHROOM_BLOCK |
| 19 | + ); |
| 20 | + |
| 21 | + public ShroomlightRecipe(KiriSmpPlugin plugin) { |
| 22 | + this.plugin = plugin; |
| 23 | + } |
| 24 | + |
| 25 | + public void register(ConfigurationSection config) { |
| 26 | + if (!config.getBoolean("shroomlight")) return; |
| 27 | + |
| 28 | + NamespacedKey key = new NamespacedKey(this.plugin, "shroomlight"); |
| 29 | + ItemStack result = new ItemStack(Material.SHROOMLIGHT); |
| 30 | + |
| 31 | + ShapedRecipe recipe = new ShapedRecipe(key, result) |
| 32 | + .shape(" g", "gsg", " g") |
| 33 | + .setIngredient('g', Material.GLOWSTONE_DUST) |
| 34 | + .setIngredient('s', ShroomlightRecipe.SHROOM_BLOCKS); |
| 35 | + |
| 36 | + this.plugin.log.info("recipes: ShroomlightRecipe: Registering Custom Recipe"); |
| 37 | + Bukkit.addRecipe(recipe); |
| 38 | + } |
| 39 | +} |
0 commit comments