Class CompassBuilder
java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.CompassBuilder
The
CompassBuilder class extends ItemBuilder to provide
additional functionality for modifying CompassMeta of an ItemStack.
This class allows setting and retrieving lodestone locations and tracking status.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aCompassBuilderwith a new compass item.CompassBuilder(@NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aCompassBuilderusing an existingItemStack. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.LocationGets the lodestone location of the compass.booleanChecks if the compass has a lodestone location set.booleanChecks if the compass is tracking a lodestone.setLodestone(@NotNull org.bukkit.Location lodestone) Sets the lodestone location for the compass.setLodestoneTracked(boolean tracked) Sets whether the compass is tracking a lodestone.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
-
CompassBuilder
public CompassBuilder()Constructs aCompassBuilderwith a new compass item. -
CompassBuilder
public CompassBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aCompassBuilderusing an existingItemStack.- Parameters:
itemStack- the item stack to modify- Throws:
IllegalArgumentException- if the item's meta is not an instance ofCompassMeta
-
-
Method Details
-
setLodestone
Sets the lodestone location for the compass.- Parameters:
lodestone- the lodestone location to set- Returns:
- this
CompassBuilderinstance for method chaining
-
getLodestone
public org.bukkit.Location getLodestone()Gets the lodestone location of the compass.- Returns:
- the lodestone location, or null if none is set
-
hasLodestone
public boolean hasLodestone()Checks if the compass has a lodestone location set.- Returns:
- true if a lodestone is set, false otherwise
-
setLodestoneTracked
Sets whether the compass is tracking a lodestone.- Parameters:
tracked- true if the compass should track a lodestone, false otherwise- Returns:
- this
CompassBuilderinstance for method chaining
-
isLodestoneTracked
public boolean isLodestoneTracked()Checks if the compass is tracking a lodestone.- Returns:
- true if the compass is tracking a lodestone, false otherwise
-