Class CustomToolItem.Builder
java.lang.Object
com.github.imdabigboss.easydatapack.api.items.CustomItem.Builder
com.github.imdabigboss.easydatapack.api.items.CustomToolItem.Builder
- Enclosing class:
- CustomToolItem
This class represents a builder for a custom tool item.
-
Field Summary
Fields inherited from class com.github.imdabigboss.easydatapack.api.items.CustomItem.Builder
allowedEnchantments, attributeModifiers, baseMaterial, customModelData, enchantments, eventListener, forbiddenEnchantments, hideFlags, itemUseEvent, lore, name, namespaceKey, newItem, spacingBeforeLore, unbreakable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull CustomToolItembuild()Builds the custom tool item.@NonNull CustomToolItem.BuilderplayerBreakBlockEvent(@Nullable Consumer<org.bukkit.event.block.BlockBreakEvent> playerBreakBlockEvent)Sets the event that is called when a player breaks a block with the tool.@NonNull CustomToolItem.BuilderplayerHitEntityEvent(@Nullable Consumer<org.bukkit.event.entity.EntityDamageByEntityEvent> playerHitEntityEvent)Sets the event that is called when a player hits an entity with the tool.Methods inherited from class com.github.imdabigboss.easydatapack.api.items.CustomItem.Builder
allowedEnchantment, attributeModifier, enchantment, eventListener, forbiddenEnchantment, hideFlags, itemUseEvent, lore, lore, newItem, unbreakable
-
Constructor Details
-
Builder
public Builder(int customModelData, @NonNull String namespaceKey, @NonNull String name, @NonNull org.bukkit.Material baseMaterial, double attackDamage, double attackSpeed)Creates a new builder for a custom tool item.- Parameters:
customModelData- the custom model data of the itemnamespaceKey- the namespace key of the itemname- the name of the itembaseMaterial- the base material of the itemattackDamage- the attack damage of the toolattackSpeed- the attack speed of the tool
-
-
Method Details
-
playerHitEntityEvent
public @NonNull CustomToolItem.Builder playerHitEntityEvent(@Nullable @Nullable Consumer<org.bukkit.event.entity.EntityDamageByEntityEvent> playerHitEntityEvent)Sets the event that is called when a player hits an entity with the tool.- Parameters:
playerHitEntityEvent- the event that is called when a player hits an entity with the tool- Returns:
- the builder
-
playerBreakBlockEvent
public @NonNull CustomToolItem.Builder playerBreakBlockEvent(@Nullable @Nullable Consumer<org.bukkit.event.block.BlockBreakEvent> playerBreakBlockEvent)Sets the event that is called when a player breaks a block with the tool.- Parameters:
playerBreakBlockEvent- the event that is called when a player breaks a block with the tool- Returns:
- the builder
-
build
Builds the custom tool item.- Overrides:
buildin classCustomItem.Builder- Returns:
- the custom tool item
-