Package valorless.havenbags.features
Class CustomBags
java.lang.Object
valorless.havenbags.features.CustomBags
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.ItemStackCreates a custom bag item for the provided key.static voidstatic voidinitiate()list()static booleanrequiresPlayer(String key) Checks if a custom bag key requires a player context when created viaget(String, Player).
-
Field Details
-
file
public static valorless.valorlessutils.config.Config file -
bags
-
-
Constructor Details
-
CustomBags
public CustomBags()
-
-
Method Details
-
initiate
public static void initiate() -
list
-
give
-
requiresPlayer
Checks if a custom bag key requires a player context when created viaget(String, Player).Returns
truewhen the bag has predefined/custom content and needs a player to initialize owner-bound data.- Parameters:
key- custom bag key- Returns:
trueif a player is required for this bag key
-
get
public static org.bukkit.inventory.ItemStack get(String key, @Nullable org.bukkit.entity.Player player) Creates a custom bag item for the provided key.The
playerargument is only used whenrequiresPlayer(String)returnstruefor the provided key. If it returnsfalse, the player value is not used for predefined content initialization.- Parameters:
key- custom bag keyplayer- player context; only required/used whenrequiresPlayer(String)istrue- Returns:
- the created and configured bag
ItemStack - Throws:
NullPointerException- if a player context is required butplayerisnullIllegalArgumentException- if the provided key does not exist in the custom bags configuration
-