Class MapBuilder
java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.MapBuilder
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 Summary
ConstructorsConstructorDescriptionConstructs aMapBuilder
with a newMaterial.MAP
.MapBuilder
(@NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aMapBuilder
using an existingItemStack
. -
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.Color
getColor()
Gets the current map color.@Nullable org.bukkit.map.MapView
Gets the associatedMapView
of this map.boolean
hasColor()
Checks if the map has a custom color.boolean
Checks if the map has an associatedMapView
.boolean
Checks if the map is set to scale dynamically.setColor
(@NotNull org.bukkit.Color color) Sets the map color.setMapView
(@NotNull org.bukkit.map.MapView mapView) Sets the associatedMapView
for this map.setScaling
(boolean scaling) Sets whether the map should scale dynamically.Methods inherited from class io.github.lucfr1746.llibrary.itemstack.ItemBuilder
addAttributeModifier, addEnchant, addEnchant, addEnchant, addItemFlags, addLore, build, getAmount, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCustomModelData, getDamageResistant, getDisplayName, getEnchantable, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getEquippableComponent, getFoodComponent, getItemFlags, getItemMeta, getItemModel, getJukeboxPlayableComponent, getMaxStackSize, getRarity, getToolComponent, getTooltipStyle, getTranslationKey, getType, getUseCooldownComponent, getUseRemainder, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasDamageResistant, hasEnchant, hasEnchantable, hasEnchantmentGlintOverride, hasEnchants, hasEquippableComponent, hasFoodComponent, hasItemFlag, hasItemModel, hasJukeboxPlayableComponent, hasMaxStackSize, hasRarity, hasToolComponent, hasTooltipStyle, hasUseCooldownComponent, hasUseRemainder, hideAllItemFlags, insertLore, isGlider, isHideTooltip, isUnbreakable, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchants, removeItemFlags, replaceLore, setAmount, setAttributeModifiers, setCustomModelData, setDamageResistant, setDisplayName, setEnchantable, setEnchantmentGlintOverride, setEquippableComponent, setEquippableComponent, setFood, setFoodComponent, setGlider, setHideTooltip, setItemModel, setItemModel, setJukeboxPlayableComponent, setJukeboxPlayableComponent, setJukeboxPlayableComponent, setLores, setLores, setMaxStackSize, setRarity, setToolComponent, setToolComponent, setTooltipStyle, setTooltipStyle, setType, setUnbreakable, setUseCooldownComponent, setUseCooldownComponent, setUseCooldownComponent, setUseRemainder
-
Constructor Details
-
MapBuilder
public MapBuilder()Constructs aMapBuilder
with a newMaterial.MAP
. -
MapBuilder
public MapBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aMapBuilder
using an existingItemStack
.- Parameters:
itemStack
- the item stack to modify- Throws:
IllegalArgumentException
- if the item's meta is not an instance ofMapMeta
-
-
Method Details
-
setColor
Sets the map color.- Parameters:
color
- theColor
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
Sets the associatedMapView
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 associatedMapView
of this map.- Returns:
- the map view, or null if none is set
-
hasMapView
public boolean hasMapView()Checks if the map has an associatedMapView
.- Returns:
- true if a map view is associated, false otherwise
-
setScaling
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
-