1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Added new api method for researches

This commit is contained in:
TheBusyBiscuit 2020-05-09 10:41:36 +02:00
parent c4026966a2
commit 922444c046

View File

@ -11,6 +11,7 @@ import org.bukkit.Keyed;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent; import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; 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 * @param items
* Instances of {@link SlimefunItem} to bind to this {@link Research} * 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}. * Lists every {@link SlimefunItem} that is bound to this {@link Research}.
* *