Package org.yuemi.libs.api.items
Interface ItemProvider
public interface ItemProvider
Represents a specific item provider (e.g. Vanilla, Nexo, ItemsAdder, CraftEngine, etc.).
-
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.inventory.ItemStackGets an item stack by its ID.intgetItemCount(@NotNull org.bukkit.entity.Player player, @NotNull String id) Gets the count of matching items in the player's inventory.@NotNull StringgetName()Gets the unique name of this item provider.booleanGives an item to the player.booleanChecks if this item provider is available.booleanTakes an item from the player's inventory.
-
Method Details
-
getName
Gets the unique name of this item provider.- Returns:
- the provider name
-
isAvailable
boolean isAvailable()Checks if this item provider is available.- Returns:
- true if available, false otherwise
-
getItem
Gets an item stack by its ID.- Parameters:
id- the item IDamount- the item quantity- Returns:
- the item stack, or null if not found
-
giveItem
boolean giveItem(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String id, int amount) Gives an item to the player.- Parameters:
player- the playerid- the item IDamount- the item quantity- Returns:
- true if successful, false otherwise
-
takeItem
boolean takeItem(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String id, int amount) Takes an item from the player's inventory.- Parameters:
player- the playerid- the item IDamount- the item quantity to take- Returns:
- true if successful, false otherwise
-
getItemCount
Gets the count of matching items in the player's inventory.- Parameters:
player- the playerid- the item ID- Returns:
- the number of matching items in player's inventory
-