Package space.maxus.flare.item
Class Items
java.lang.Object
space.maxus.flare.item.Items
A utility class for manipulations with items inside Flare
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.bukkit.inventory.ItemStackDeprecated, for removal: This API element is subject to removal in a future version.Scheduled to be removed when local error handling is implemented (approx. -
Method Summary
Modifier and TypeMethodDescriptionstatic ItemStackBuilderbuilder(org.bukkit.Material material) Constructs a new item stack builder for provided item typestatic ItemStackBuilderbuilder(org.bukkit.Material material, @Nullable org.bukkit.entity.Player player) Constructs a new item stack builder for provided item type with PlaceholderAPI placeholder supportstatic org.bukkit.inventory.ItemStackempty()Constructs an empty ItemStack of typeMaterial.GRAY_STAINED_GLASS_PANE.static org.bukkit.inventory.ItemStackempty(org.bukkit.Material material) Constructs an ItemStack with empty name and lore of provided Materialstatic org.bukkit.inventory.ItemStackDeprecated.Scheduled to be removed when local error handling is implemented (approx.static org.bukkit.inventory.ItemStackConstructs a new player head item with provided skin Base64 string.static org.bukkit.inventory.ItemStackConstructs a new player head item with provided skin Base64 string and additional meta.static <T extends org.bukkit.inventory.meta.ItemMeta>
Consumer<T>Returns a consumer that will set the lore of itemstatic <T extends org.bukkit.inventory.meta.ItemMeta>
Consumer<T>Returns a consumer that will set the lore of itemstatic org.bukkit.inventory.ItemStackConstructs a new item stack with provided lorestatic org.bukkit.inventory.ItemStackwithMeta(org.bukkit.Material material, @NotNull Consumer<org.bukkit.inventory.meta.ItemMeta> configurator) Constructs a new item with provided material and meta.static org.bukkit.inventory.ItemStackConstructs a new item stack with provided lorestatic org.bukkit.inventory.ItemStackwithName(org.bukkit.Material material, @NotNull String name, @Nullable org.bukkit.entity.Player player) Constructs a new item stack with provided lorestatic <M extends org.bukkit.inventory.meta.ItemMeta>
org.bukkit.inventory.ItemStackwithTypedMeta(org.bukkit.Material material, @NotNull Consumer<M> configurator) Constructs a new item with provided material and meta of certain type.
-
Field Details
-
genericErrorItem
@ScheduledForRemoval(inVersion="1.1.0") @Deprecated(since="0.9.0", forRemoval=true) public static final org.bukkit.inventory.ItemStack genericErrorItemDeprecated, for removal: This API element is subject to removal in a future version.Scheduled to be removed when local error handling is implemented (approx. 1.1.0)A generic error item returned when an error happens while building an item.
-
-
Method Details
-
loreMeta
Returns a consumer that will set the lore of item- Type Parameters:
T- Type of item meta- Parameters:
lore- Lore to be transformed into components viaFlareUtil.partitionString(String)- Returns:
- A consumer that takes item meta and applies lore to it
-
loreMeta
public static <T extends org.bukkit.inventory.meta.ItemMeta> Consumer<T> loreMeta(String lore, @Nullable @Nullable org.bukkit.entity.Player player) Returns a consumer that will set the lore of item- Type Parameters:
T- Type of item meta- Parameters:
lore- Lore to be transformed into components viaFlareUtil.partitionString(String)player- Player used for PlaceholderAPI Placeholder resolution- Returns:
- A consumer that takes item meta and applies lore to it
-
head
Constructs a new player head item with provided skin Base64 string.
Skin can be taken from Minecraft Heads, Crafatar or any other API.- Parameters:
skin- Base64 skin string to be applied to player- Returns:
- Constructed ItemStack
-
head
public static org.bukkit.inventory.ItemStack head(String skin, Consumer<org.bukkit.inventory.meta.SkullMeta> configurator) Constructs a new player head item with provided skin Base64 string and additional meta.
Skin can be taken from Minecraft Heads, Crafatar or any other API.- Parameters:
skin- Base64 skin string to be applied to playerconfigurator- Consumer that applies extra data to item meta- Returns:
- Constructed ItemStack
-
withTypedMeta
public static <M extends org.bukkit.inventory.meta.ItemMeta> org.bukkit.inventory.ItemStack withTypedMeta(org.bukkit.Material material, @NotNull @NotNull Consumer<M> configurator) Constructs a new item with provided material and meta of certain type.
NOTE: will returngenericErrorItemif meta is not of expected type.- Type Parameters:
M- Type of meta to be applied. Must match meta of provided material- Parameters:
material- Material of the itemconfigurator- Consumer that takes ItemMeta of typeItemsand applies extra data to it- Returns:
- A new ItemStack with provided material and meta.
-
withMeta
public static org.bukkit.inventory.ItemStack withMeta(org.bukkit.Material material, @NotNull @NotNull Consumer<org.bukkit.inventory.meta.ItemMeta> configurator) Constructs a new item with provided material and meta.- Parameters:
material- Material of the itemconfigurator- Consumer that takes ItemMeta and applies extra data to it- Returns:
- A new ItemStack with provided material and meta.
-
withLore
public static org.bukkit.inventory.ItemStack withLore(org.bukkit.Material material, @NotNull @NotNull String lore) Constructs a new item stack with provided lore- Parameters:
material- Material of the itemlore- Lore to be applied to item vialoreMeta(String)- Returns:
- A new item stack with provided lore
-
withName
public static org.bukkit.inventory.ItemStack withName(org.bukkit.Material material, @NotNull @NotNull String name) Constructs a new item stack with provided lore- Parameters:
material- Material of the itemname- Name to be applied to item- Returns:
- A new item stack with provided lore
-
withName
public static org.bukkit.inventory.ItemStack withName(org.bukkit.Material material, @NotNull @NotNull String name, @Nullable @Nullable org.bukkit.entity.Player player) Constructs a new item stack with provided lore- Parameters:
material- Material of the itemname- Name to be applied to itemplayer- Player used for PlaceholderAPI placeholder resolution- Returns:
- A new item stack with provided lore
-
builder
Constructs a new item stack builder for provided item type- Parameters:
material- Material of the item- Returns:
- A new item stack builder
-
builder
public static ItemStackBuilder builder(org.bukkit.Material material, @Nullable @Nullable org.bukkit.entity.Player player) Constructs a new item stack builder for provided item type with PlaceholderAPI placeholder support- Parameters:
material- Material of the itemplayer- Player to be used for PlaceholderAPI placeholder resolution- Returns:
- A new item stack builder
-
empty
public static org.bukkit.inventory.ItemStack empty(org.bukkit.Material material) Constructs an ItemStack with empty name and lore of provided Material- Parameters:
material- Material of the ItemStack to be constructed- Returns:
- Constructed ItemStack
-
empty
public static org.bukkit.inventory.ItemStack empty()Constructs an empty ItemStack of typeMaterial.GRAY_STAINED_GLASS_PANE. Can be useful for creating backgrounds- Returns:
- Empty ItemStack of type
Material.GRAY_STAINED_GLASS_PANE
-
getGenericErrorItem
Deprecated.Scheduled to be removed when local error handling is implemented (approx. 1.1.0)A generic error item returned when an error happens while building an item.
-