From 922444c04696e442d199d61d315c61727143bd32 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 9 May 2020 10:41:36 +0200 Subject: [PATCH] Added new api method for researches --- .../slimefun4/core/researching/Research.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java index db58fa6f7..384255a91 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java @@ -11,6 +11,7 @@ import org.bukkit.Keyed; import org.bukkit.NamespacedKey; import org.bukkit.Sound; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; @@ -139,7 +140,7 @@ public class Research implements Keyed { } /** - * Bind the specified Slimefun items to this {@link Research}. + * Bind the specified {@link SlimefunItem SlimefunItems} to this {@link Research}. * * @param items * Instances of {@link SlimefunItem} to bind to this {@link Research} @@ -152,6 +153,26 @@ public class Research implements Keyed { } } + /** + * Bind the specified ItemStacks to this {@link Research}. + * + * @param items + * Instances of {@link ItemStack} to bind to this {@link Research} + * + * @return The current instance of {@link Research} + */ + public Research addItems(ItemStack... items) { + for (ItemStack item : items) { + SlimefunItem sfItem = SlimefunItem.getByItem(item); + + if (sfItem != null) { + sfItem.setResearch(this); + } + } + + return this; + } + /** * Lists every {@link SlimefunItem} that is bound to this {@link Research}. *