Interface ToolComponent.ToolRule
- All Superinterfaces:
ConfigurationSerializable
- Enclosing interface:
ToolComponent
A rule governing use of this tool and overriding attributes per-block.
-
Method Summary
Modifier and TypeMethodDescriptionGet a collection of the block types to which this tool rule applies.getSpeed()
Get the mining speed of this rule.Get whether or not this rule is considered the optimal tool for the blocks listed by this rule and will drop items.void
setBlocks
(Collection<Material> blocks) Set the block types to which this rule applies.void
Set the block type to which this rule applies.void
Set the block types (represented as a blockTag
) to which this rule applies.void
setCorrectForDrops
(Boolean correct) Set whether or not this rule is considered the optimal tool for the blocks listed by this rule and will drop items.void
Set the mining speed of this rule.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
Method Details
-
getBlocks
Get a collection of the block types to which this tool rule applies.- Returns:
- the blocks
-
setBlocks
Set the block type to which this rule applies.- Parameters:
block
- the block type
-
setBlocks
Set the block types to which this rule applies.- Parameters:
blocks
- the block types
-
setBlocks
Set the block types (represented as a blockTag
) to which this rule applies.- Parameters:
tag
- the block tag- Throws:
IllegalArgumentException
- if the passedtag
is not a block tag
-
getSpeed
Get the mining speed of this rule. If non-null, this speed value is used in lieu of the default speed value of the tool. 1.0 is standard mining speed.- Returns:
- the mining speed, or null if the default speed is used
-
setSpeed
Set the mining speed of this rule. 1.0 is standard mining speed.- Parameters:
speed
- the mining speed, or null to use the default speed
-
isCorrectForDrops
Get whether or not this rule is considered the optimal tool for the blocks listed by this rule and will drop items. If non-null, this value is used in lieu of the default tool checking behavior defined by Minecraft.- Returns:
- true if correct for drops, false otherwise, or null to fallback to vanilla tool checking behavior
-
setCorrectForDrops
Set whether or not this rule is considered the optimal tool for the blocks listed by this rule and will drop items.- Parameters:
correct
- whether or not this rule is correct for drops, or null to fallback to vanilla tool checking behavior
-