java.lang.Object
me.remigio07.chatplugin.api.server.util.adapter.inventory.item.ItemFlagAdapter

public class ItemFlagAdapter extends Object
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 Details

    • HIDE_ARMOR_TRIM

      public static final ItemFlagAdapter HIDE_ARMOR_TRIM
      Hides trim upgrades applied to an armor.

      Minimum version: 1.19.4

    • HIDE_ENCHANTMENTS

      public static final ItemFlagAdapter HIDE_ENCHANTMENTS
      Hides enchantments applied to an item.
    • HIDE_ATTRIBUTES

      public static final ItemFlagAdapter HIDE_ATTRIBUTES
      Hides attributes applied to an item.
    • HIDE_DYE

      public static final ItemFlagAdapter HIDE_DYE
      Hides a leather armor's color information.

      Minimum version: 1.16.2

    • HIDE_UNBREAKABLE

      public static final ItemFlagAdapter HIDE_UNBREAKABLE
      Hides the "Unbreakable" state of an item.
    • HIDE_CAN_DESTROY

      public static final ItemFlagAdapter HIDE_CAN_DESTROY
      Hides what the item can destroy.
    • HIDE_CAN_BE_PLACED_ON

      public static final ItemFlagAdapter HIDE_CAN_BE_PLACED_ON
      Hides what the item can be placed on.
    • HIDE_MISCELLANEOUS

      public static final ItemFlagAdapter 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

      public String name()
      Equivalent of Enum.name().
      Returns:
      Constant's name
    • ordinal

      public int ordinal()
      Equivalent of Enum.ordinal().
      Returns:
      Constant's ordinal
    • getIDs

      public String[] 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

      public VersionUtils.Version 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 on VersionUtils.getVersion().
      Returns:
      Whether this item flag is supported
    • valueOf

      public static ItemFlagAdapter valueOf(String name)
      Equivalent of Enum#valueOf(String), with the only difference that instead of throwing IllegalArgumentException 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

      public static ItemFlagAdapter[] values()
      Equivalent of Enum#values().
      Returns:
      Enum constants
    • valuesOf

      public static ItemFlagAdapter[] valuesOf(Configuration configuration, String path)
      Util method used to get item flags at the specified path inside of a configuration.
      Parameters:
      configuration - Configuration containing the values
      path - Path containing the values
      Returns:
      Values specified at given path