Class IconLayout

java.lang.Object
me.remigio07.chatplugin.api.server.gui.IconLayout

public class IconLayout extends Object
Represents a IconType.GENERATED icon's layout inside of a FillableGUI.
  • Constructor Details

    • IconLayout

      public IconLayout(Configuration configuration, String path)
      Reads an icon layout from the specified configuration and path.

      The icon's ID is the text after path's last dot ('.') or path if it does not contain any and has to match Icon.ICON_ID_PATTERN.

      Parameters:
      configuration - Configuration to read
      path - Icon layout's path
      Throws:
      IllegalArgumentException - If icon's ID !Icon.isValidIconID(String) or material's ID found at path + ".material" is invalid
      NumberFormatException - If color found at path + ".leather-color-armor" is not null and is invalid (does not respect the format required by Color.decode(String))
    • IconLayout

      public IconLayout(String id, MaterialAdapter material, boolean keepOpen, boolean glowing, ValueContainer<Short> amount, short damage)
      Constructs a new icon layout specifying onlt the essential options and assuming the others as their default values.

      Note: IconLayout(Configuration, String) is capable of reading icon layouts from Configurations. Use this constructor just to obtain custom icon layouts via code.

      Parameters:
      id - Icon layout's ID
      material - Icon layout's material
      keepOpen - Whether the GUI will remain open on click
      glowing - Whether the glowing effect should be applied
      amount - Icon layout's items' amount [0 - 64]
      damage - Icon layout's items' damage [0 - max durability]
    • IconLayout

      public IconLayout(String id, MaterialAdapter material, ValueContainer<Short> amount, short damage, boolean keepOpen, boolean glowing, String skullOwner, String skullTextureURL, Color leatherArmorColor, List<String> commands, List<ItemFlagAdapter> itemFlags, Map<Language,String> displayNames, Map<Language,List<String>> lores, Map<EnchantmentAdapter,Integer> enchantments)
      Constructs a new icon layout specifying all the available options.

      Note: IconLayout(Configuration, String) is capable of reading icon layouts from Configurations. Use this constructor just to obtain custom icon layouts via code.

      It is recommended to use thread-safe collections.

      Parameters:
      id - Icon layout's ID
      material - Icon layout's material
      amount - Icon layout's items' amount [0 - 64]
      damage - Icon layout's items' damage [0 - max durability]
      keepOpen - Whether the GUI will remain open on click
      glowing - Whether the glowing effect should be applied
      skullOwner - Icon layout's skull's owner
      skullTextureURL - Icon layout's skull's texture's URL
      leatherArmorColor - Icon layout's leather armor's color
      commands - Icon layout's commands executed on click
      itemFlags - Icon layout's item flags
      displayNames - Icon layout's display names
      lores - Icon layout's lores
      enchantments - Icon layout's enchantments
  • Method Details

    • getID

      public String getID()
      Gets this icon layout's ID.
      Returns:
      Icon layout's ID
    • getMaterial

      public MaterialAdapter getMaterial()
      Gets this icon layout's material.
      Returns:
      Icon layout's material
    • setMaterial

      public IconLayout setMaterial(MaterialAdapter material)
      Sets this icon layout's material.
      Parameters:
      material - Icon layout's material
      Returns:
      This icon layout
    • getAmount

      public ValueContainer<Short> getAmount()
      Gets this icon layout's items' amount.
      Returns:
      Icon layout's items' amount [0 - 64]
    • setAmount

      public IconLayout setAmount(ValueContainer<Short> amount)
      Sets this icon layout's items' amount.
      Parameters:
      amount - Icon layout's items' amount [0 - 64]
      Returns:
      This icon layout
    • getDamage

      public short getDamage()
      Gets this icon layout's items' damage.
      Returns:
      Icon layout's items' damage [0 - max durability]
    • setDamage

      public IconLayout setDamage(short damage)
      Sets this icon layout's items' damage.
      Parameters:
      damage - Icon layout's items' damage [0 - max durability]
      Returns:
      This icon layout
    • isKeepOpen

      public boolean isKeepOpen()
      Checks if the GUI should be kept open when this icon layout is clicked.
      Returns:
      Whether the GUI will remain open on click
    • setKeepOpen

      public IconLayout setKeepOpen(boolean keepOpen)
      Sets if the GUI should be kept open when this icon layout is clicked.
      Parameters:
      keepOpen - Whether the GUI will remain open on click
      Returns:
      This icon layout
    • isGlowing

      public boolean isGlowing()
      Checks if the glowing effect should be applied to this icon layout.
      Returns:
      Whether the glowing effect should be applied
    • setGlowing

      public IconLayout setGlowing(boolean glowing)
      Sets if the glowing effect should be applied to this icon layout.
      Parameters:
      glowing - Whether the glowing effect should be applied
      Returns:
      This icon layout
    • getSkullOwner

      public String getSkullOwner()
      Gets this icon layout's skull's owner.

      Will return null if the skull's owner has not been specified.

      Returns:
      Icon layout's skull's owner
    • setSkullOwner

      public IconLayout setSkullOwner(String skullOwner)
      Sets this icon layout's skull's owner.

      You can specify null to remove the skull's owner.

      Parameters:
      skullOwner - Icon layout's skull's owner
      Returns:
      This icon layout
    • getSkullTextureURL

      public String getSkullTextureURL()
      Gets this icon layout's skull's texture's URL.

      Will return null if the skull's texture's URL has not been specified.

      Returns:
      Icon layout's skull's texture's URL
    • setSkullTextureURL

      public IconLayout setSkullTextureURL(String skullTextureURL)
      Sets this icon layout's skull's texture's URL.

      You can specify null to remove the skull's texture's URL.

      Parameters:
      skullTextureURL - Icon layout's skull's texture's URL
      Returns:
      This icon layout
    • getLeatherArmorColor

      public Color getLeatherArmorColor()
      Gets this icon layout's leather armor's color.

      Will return null if the leather armor's color has not been specified.

      Returns:
      Icon layout's leather armor's color
    • setLeatherArmorColor

      public IconLayout setLeatherArmorColor(Color leatherArmorColor)
      Sets this icon layout's leather armor's color.

      If you need to reset the color to the default value, specify null and the following hex code will be applied: "#A06540".

      Parameters:
      leatherArmorColor - Icon layout's leather armor's color
      Returns:
      This icon layout
    • getCommands

      public List<String> getCommands()
      Gets the commands that will be executed when this icon layout is clicked.

      You may modify the returned list.

      Returns:
      Icon layout's commands executed on click
    • getItemFlags

      public List<ItemFlagAdapter> getItemFlags()
      Gets this icon layout's item flags.

      You may modify the returned list.

      Returns:
      Icon layout's item flags
    • getDisplayNames

      public Map<Language,String> getDisplayNames()
      Gets this icon layout's display names.

      You may modify the returned map.

      Returns:
      Icon layout's display names
    • getLores

      public Map<Language,List<String>> getLores()
      Gets this icon layout's lores.

      You may modify the returned map.

      Returns:
      Icon layout's lores
    • getEnchantments

      public Map<EnchantmentAdapter,Integer> getEnchantments()
      Gets this icon layout's enchantments.

      You may modify the returned map.

      Returns:
      Icon layout's enchantments