Class ItemFlagAdapter
java.lang.Object
me.remigio07.chatplugin.api.server.util.adapter.inventory.item.ItemFlagAdapter
Environment indipendent (Bukkit and Sponge) item flag adapter.
This class is a pseudo-Enum
. It contains the following methods:
name()
, ordinal()
, valueOf(String)
and values()
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ItemFlagAdapter
Hides trim upgrades applied to an armor.static final ItemFlagAdapter
Hides attributes applied to an item.static final ItemFlagAdapter
Hides what the item can be placed on.static final ItemFlagAdapter
Hides what the item can destroy.static final ItemFlagAdapter
Hides a leather armor's color information.static final ItemFlagAdapter
Hides enchantments applied to an item.static final ItemFlagAdapter
Hides an item's potion effects, book and firework information, map tooltips, patterns of banners and enchantments of enchanted books.static final ItemFlagAdapter
Hides the "Unbreakable" state of an item. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemFlag
Gets the item flag adapted for Bukkit environments.String[]
getIDs()
Gets this item flag's IDs.Gets the minimum supported version for this item flag.boolean
Checks if this item flag is supported onVersionUtils.getVersion()
.name()
Equivalent ofEnum.name()
.int
ordinal()
Equivalent ofEnum.ordinal()
.org.spongepowered.api.data.key.Key
<org.spongepowered.api.data.value.mutable.Value<Boolean>> Gets the item flag adapted for Sponge environments.static ItemFlagAdapter
Equivalent ofEnum#valueOf(String)
, with the only difference that instead of throwingIllegalArgumentException
null
is returned if the constant's name is invalid.static ItemFlagAdapter[]
values()
Equivalent ofEnum#values()
.static ItemFlagAdapter[]
valuesOf
(Configuration configuration, String path) Util method used to get item flags at the specified path inside of a configuration.
-
Field Details
-
HIDE_ARMOR_TRIM
Hides trim upgrades applied to an armor.Minimum version: 1.19.4
-
HIDE_ENCHANTMENTS
Hides enchantments applied to an item. -
HIDE_ATTRIBUTES
Hides attributes applied to an item. -
HIDE_DYE
Hides a leather armor's color information.Minimum version: 1.16.2
-
HIDE_UNBREAKABLE
Hides the "Unbreakable" state of an item. -
HIDE_CAN_DESTROY
Hides what the item can destroy. -
HIDE_CAN_BE_PLACED_ON
Hides what the item can be placed on. -
HIDE_MISCELLANEOUS
Hides an item's potion effects, book and firework information, map tooltips, patterns of banners and enchantments of enchanted books.
-
-
Method Details
-
bukkitValue
public org.bukkit.inventory.ItemFlag bukkitValue()Gets the item flag adapted for Bukkit environments.If the current version does not support this item flag, the default value of
HIDE_ATTRIBUTES
will be returned.- Returns:
- Bukkit-adapted item flag
- Throws:
UnsupportedOperationException
- If!
Environment.isBukkit()
-
spongeValue
public org.spongepowered.api.data.key.Key<org.spongepowered.api.data.value.mutable.Value<Boolean>> spongeValue()Gets the item flag adapted for Sponge environments.If the current version does not support this item flag, the default value of
HIDE_ATTRIBUTES
will be returned.- Returns:
- Sponge-adapted item flag
- Throws:
UnsupportedOperationException
- If!
Environment.isSponge()
-
name
Equivalent ofEnum.name()
.- Returns:
- Constant's name
-
ordinal
public int ordinal()Equivalent ofEnum.ordinal()
.- Returns:
- Constant's ordinal
-
getIDs
Gets this item flag's IDs.The first element in the array is the Bukkit-compatible ID, the second one is the Sponge-compatible ID.
- Returns:
- Item flag's IDs
-
getMinimumVersion
Gets the minimum supported version for this item flag.Will return
null
if all versions supported by ChatPlugin support this item flag.- Returns:
- Item flag's minimum version
-
isSupported
public boolean isSupported()Checks if this item flag is supported onVersionUtils.getVersion()
.- Returns:
- Whether this item flag is supported
-
valueOf
Equivalent ofEnum#valueOf(String)
, with the only difference that instead of throwingIllegalArgumentException
null
is returned if the constant's name is invalid.This method recognizes both Bukkit's and Sponge's IDs.
- Parameters:
name
- Constant's name- Returns:
- Enum constant
-
values
Equivalent ofEnum#values()
.- Returns:
- Enum constants
-
valuesOf
Util method used to get item flags at the specified path inside of a configuration.- Parameters:
configuration
- Configuration containing the valuespath
- Path containing the values- Returns:
- Values specified at given path
-