Class BannerBuilder

java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.BannerBuilder

public class BannerBuilder extends ItemBuilder
The BannerBuilder class extends ItemBuilder to provide additional functionality for modifying BannerMeta of an ItemStack. This class allows setting, adding, and removing patterns for custom banners.
  • Constructor Details

    • BannerBuilder

      public BannerBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Constructs a BannerBuilder using an existing ItemStack.
      Parameters:
      itemStack - the item stack to modify
      Throws:
      IllegalArgumentException - if the item's meta is not an instance of BannerMeta
    • BannerBuilder

      public BannerBuilder()
      Constructs a BannerBuilder with a default banner.
  • Method Details

    • addPattern

      public BannerBuilder addPattern(@NotNull @NotNull org.bukkit.DyeColor color, @NotNull @NotNull org.bukkit.block.banner.PatternType pattern)
      Adds a new pattern to the banner.
      Parameters:
      color - the pattern color
      pattern - the pattern type
      Returns:
      this BannerBuilder instance for method chaining
    • addPattern

      public BannerBuilder addPattern(@NotNull @NotNull org.bukkit.block.banner.Pattern pattern)
      Adds a new pattern to the banner.
      Parameters:
      pattern - the pattern to add
      Returns:
      this BannerBuilder instance for method chaining
    • setPattern

      public BannerBuilder setPattern(int index, @NotNull @NotNull org.bukkit.block.banner.Pattern pattern)
      Sets the pattern at the specified index.
      Parameters:
      index - the index to set the pattern at
      pattern - the pattern to set
      Returns:
      this BannerBuilder instance for method chaining
    • getPattern

      public org.bukkit.block.banner.Pattern getPattern(int index)
      Retrieves the pattern at the specified index.
      Parameters:
      index - the index of the pattern
      Returns:
      the pattern at the specified index
    • getPatterns

      public List<org.bukkit.block.banner.Pattern> getPatterns()
      Returns a list of all patterns applied to the banner.
      Returns:
      a list of patterns on the banner
    • numberOfPatterns

      public int numberOfPatterns()
      Returns the number of patterns applied to the banner.
      Returns:
      the number of patterns
    • removePattern

      public BannerBuilder removePattern(int index)
      Removes the pattern at the specified index.
      Parameters:
      index - the index of the pattern to remove
      Returns:
      this BannerBuilder instance for method chaining
    • setPatterns

      public BannerBuilder setPatterns(@NotNull @NotNull List<org.bukkit.block.banner.Pattern> patterns)
      Sets the patterns used on the banner.
      Parameters:
      patterns - the list of patterns to set
      Returns:
      this BannerBuilder instance for method chaining