Class MapBuilder

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

public class MapBuilder extends ItemBuilder
The MapBuilder class extends ItemBuilder to provide additional functionality for modifying MapMeta of an ItemStack. This class allows setting map colors, map views, and scaling.
  • Constructor Details

    • MapBuilder

      public MapBuilder()
      Constructs a MapBuilder with a new Material.MAP.
    • MapBuilder

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

    • setColor

      public MapBuilder setColor(@NotNull @NotNull org.bukkit.Color color)
      Sets the map color.
      Parameters:
      color - the Color to set for the map
      Returns:
      this MapBuilder instance for chaining
      Throws:
      IllegalArgumentException - if color is null
    • getColor

      @Nullable public @Nullable org.bukkit.Color getColor()
      Gets the current map color.
      Returns:
      the Color of the map, or default color if none is set
    • hasColor

      public boolean hasColor()
      Checks if the map has a custom color.
      Returns:
      true if the map has a custom color, false otherwise
    • setMapView

      public MapBuilder setMapView(@NotNull @NotNull org.bukkit.map.MapView mapView)
      Sets the associated MapView for this map.
      Parameters:
      mapView - the map view to associate
      Returns:
      this MapBuilder instance for chaining
      Throws:
      IllegalArgumentException - if mapView is null
    • getMapView

      @Nullable public @Nullable org.bukkit.map.MapView getMapView()
      Gets the associated MapView of this map.
      Returns:
      the map view, or null if none is set
    • hasMapView

      public boolean hasMapView()
      Checks if the map has an associated MapView.
      Returns:
      true if a map view is associated, false otherwise
    • setScaling

      public MapBuilder setScaling(boolean scaling)
      Sets whether the map should scale dynamically.
      Parameters:
      scaling - true to enable scaling, false to disable
      Returns:
      this MapBuilder instance for chaining
    • isScaling

      public boolean isScaling()
      Checks if the map is set to scale dynamically.
      Returns:
      true if scaling is enabled, false otherwise