Uncraftables/src/main/java/io/github/paldiu/CraftingUtils.java

34 lines
969 B
Java

package io.github.paldiu;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
public class CraftingUtils {
private final Uncraftables plugin;
public CraftingUtils(Uncraftables instance) {
plugin = instance;
}
@Contract("_ -> new")
private @NotNull
NamespacedKey newKey(String string) {
return new NamespacedKey(plugin, string);
}
public final @NotNull ShapedRecipe shaped(Material result, String key) {
ItemStack is = new ItemStack(result);
return new ShapedRecipe(newKey(key), is);
}
public final @NotNull ShapelessRecipe shapeless(Material result, String key) {
ItemStack is = new ItemStack(result);
return new ShapelessRecipe(newKey(key), is);
}
}