Package com.sk89q.worldguard.bukkit.util
Class Materials
java.lang.Object
com.sk89q.worldguard.bukkit.util.Materials
Material utility class.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.Material
getBucketBlockMaterial
(org.bukkit.Material type) Get the material of the block placed by the given bucket, defaulting to water if the bucket type is not known.static org.bukkit.entity.EntityType
getEntitySpawnEgg
(org.bukkit.Material material) static org.bukkit.entity.EntityType
getRelatedEntity
(org.bukkit.Material material) Get the related entity type for a material.static org.bukkit.Material
getRelatedMaterial
(org.bukkit.entity.EntityType type) Get the related material for an entity type.static boolean
hasDamageEffect
(Collection<org.bukkit.potion.PotionEffect> effects) Test whether a list of potion effects contains one or more potion effects used for doing damage.static boolean
isAmethystGrowth
(org.bukkit.Material mat) static boolean
isAnvil
(org.bukkit.Material material) static boolean
isArmor
(org.bukkit.Material type) Check if the material is equippable armor (i.e.static boolean
isBed
(org.bukkit.Material material) static boolean
isBlockModifiedOnClick
(org.bukkit.Material material, boolean rightClick) Test whether the given material is a block that is modified when it is left or right clicked.static boolean
isBoat
(org.bukkit.Material material) Test whether the given material is a Boat.static boolean
isConsideredBuildingIfUsed
(org.bukkit.Material type) Test whether the given material should be tested as "building" when it is used.static boolean
isCoral
(org.bukkit.Material material) static boolean
isCrop
(org.bukkit.Material type) Test whether the material is a crop.static boolean
isFire
(org.bukkit.Material type) static boolean
isInventoryBlock
(org.bukkit.Material material) Test whether the given material is an inventory block.static boolean
isItemAppliedToBlock
(org.bukkit.Material item, org.bukkit.Material block) Test whether the given item modifies a given block when right clicked.static boolean
isLava
(org.bukkit.Material material) Test whether the given material is lava.static boolean
isLeaf
(org.bukkit.Material material) Test whether the given material is a leaf block.static boolean
isLiquid
(org.bukkit.Material material) Test whether the given material is a liquid block.static boolean
isMinecart
(org.bukkit.Material material) Test whether the given material is a Minecart.static boolean
isMushroom
(org.bukkit.Material material) Test whether the given material is a mushroom.static boolean
isPistonBlock
(org.bukkit.Material material) Test whether the given material is a piston block, not including the "technical blocks" such as the piston extension block.static boolean
isPortal
(org.bukkit.Material material) Test whether the given material is a portal material.static boolean
isRailBlock
(org.bukkit.Material material) Test whether the given material is a rail block.static boolean
isSculkGrowth
(org.bukkit.Material mat) static boolean
isShulkerBox
(org.bukkit.Material material) Test whether the given material is a Shulker Box.static boolean
isSpawnEgg
(org.bukkit.Material material) static boolean
isToolApplicable
(org.bukkit.Material toolMaterial, org.bukkit.Material targetMaterial) Check if the material is usable via right-click on the target material.static boolean
isUnwaxedCopper
(org.bukkit.Material type) static boolean
isUseFlagApplicable
(org.bukkit.Material material) Test whether the given material is affected byFlags.USE
.static boolean
isVine
(org.bukkit.Material newType) Test whether the material should be handled as vine.static boolean
isWater
(org.bukkit.Material material) Test whether the given material is water.static boolean
isWaxedCopper
(org.bukkit.Material type)
-
Method Details
-
getRelatedMaterial
@Nullable public static org.bukkit.Material getRelatedMaterial(org.bukkit.entity.EntityType type) Get the related material for an entity type.- Parameters:
type
- the entity type- Returns:
- the related material or
null
if one is not known or exists
-
getRelatedEntity
@Nullable public static org.bukkit.entity.EntityType getRelatedEntity(org.bukkit.Material material) Get the related entity type for a material.- Parameters:
material
- the material- Returns:
- the related entity type or
null
if one is not known or exists
-
getBucketBlockMaterial
public static org.bukkit.Material getBucketBlockMaterial(org.bukkit.Material type) Get the material of the block placed by the given bucket, defaulting to water if the bucket type is not known.If a non-bucket material is given, it will be assumed to be an unknown bucket type. If the given bucket doesn't have a block form (it can't be placed), then water will be returned (i.e. for milk). Be aware that either the stationary or non-stationary material may be returned.
- Parameters:
type
- the bucket material- Returns:
- the block material
-
isMushroom
public static boolean isMushroom(org.bukkit.Material material) Test whether the given material is a mushroom.- Parameters:
material
- the material- Returns:
- true if a mushroom block
-
isLeaf
public static boolean isLeaf(org.bukkit.Material material) Test whether the given material is a leaf block.- Parameters:
material
- the material- Returns:
- true if a leaf block
-
isLiquid
public static boolean isLiquid(org.bukkit.Material material) Test whether the given material is a liquid block.- Parameters:
material
- the material- Returns:
- true if a liquid block
-
isWater
public static boolean isWater(org.bukkit.Material material) Test whether the given material is water.- Parameters:
material
- the material- Returns:
- true if a water block
-
isLava
public static boolean isLava(org.bukkit.Material material) Test whether the given material is lava.- Parameters:
material
- the material- Returns:
- true if a lava block
-
isPortal
public static boolean isPortal(org.bukkit.Material material) Test whether the given material is a portal material.- Parameters:
material
- the material- Returns:
- true if a portal block
-
isRailBlock
public static boolean isRailBlock(org.bukkit.Material material) Test whether the given material is a rail block.- Parameters:
material
- the material- Returns:
- true if a rail block
-
isPistonBlock
public static boolean isPistonBlock(org.bukkit.Material material) Test whether the given material is a piston block, not including the "technical blocks" such as the piston extension block.- Parameters:
material
- the material- Returns:
- true if a piston block
-
isMinecart
public static boolean isMinecart(org.bukkit.Material material) Test whether the given material is a Minecart.- Parameters:
material
- the material- Returns:
- true if a Minecart item
-
isBoat
public static boolean isBoat(org.bukkit.Material material) Test whether the given material is a Boat.- Parameters:
material
- the material- Returns:
- true if a Boat item
-
isShulkerBox
public static boolean isShulkerBox(org.bukkit.Material material) Test whether the given material is a Shulker Box.- Parameters:
material
- the material- Returns:
- true if a Shulker Box block
-
isInventoryBlock
public static boolean isInventoryBlock(org.bukkit.Material material) Test whether the given material is an inventory block.- Parameters:
material
- the material- Returns:
- true if an inventory block
-
isSpawnEgg
public static boolean isSpawnEgg(org.bukkit.Material material) -
getEntitySpawnEgg
public static org.bukkit.entity.EntityType getEntitySpawnEgg(org.bukkit.Material material) -
isBed
public static boolean isBed(org.bukkit.Material material) -
isAnvil
public static boolean isAnvil(org.bukkit.Material material) -
isCoral
public static boolean isCoral(org.bukkit.Material material) -
isCrop
public static boolean isCrop(org.bukkit.Material type) Test whether the material is a crop.- Parameters:
type
- the material- Returns:
- true if the material is a crop
-
isVine
public static boolean isVine(org.bukkit.Material newType) Test whether the material should be handled as vine. Used by the vine-growth flag- Parameters:
newType
- the material- Returns:
- true if the material should be handled as vine
-
isUseFlagApplicable
public static boolean isUseFlagApplicable(org.bukkit.Material material) Test whether the given material is affected byFlags.USE
.Generally, materials that are considered by this method are those that are not inventories but can be used.
- Parameters:
material
- the material- Returns:
- true if covered by the use flag
-
isBlockModifiedOnClick
public static boolean isBlockModifiedOnClick(org.bukkit.Material material, boolean rightClick) Test whether the given material is a block that is modified when it is left or right clicked.This test is conservative, returning true for blocks that it is not aware of.
- Parameters:
material
- the materialrightClick
- whether it is a right click- Returns:
- true if the block is modified
-
isItemAppliedToBlock
public static boolean isItemAppliedToBlock(org.bukkit.Material item, org.bukkit.Material block) Test whether the given item modifies a given block when right clicked.This test is conservative, returning true for items that it is not aware of or does not have the details for.
- Parameters:
item
- the itemblock
- the block- Returns:
- true if the item is applied to the block
-
isConsideredBuildingIfUsed
public static boolean isConsideredBuildingIfUsed(org.bukkit.Material type) Test whether the given material should be tested as "building" when it is used.- Parameters:
type
- the type- Returns:
- true to be considered as used
-
hasDamageEffect
Test whether a list of potion effects contains one or more potion effects used for doing damage.- Parameters:
effects
- A collection of effects- Returns:
- True if at least one damage effect exists
-
isArmor
public static boolean isArmor(org.bukkit.Material type) Check if the material is equippable armor (i.e. that it is equipped on right-click not necessarily that it can be put in the armor slots)- Parameters:
type
- material to check- Returns:
- true if equippable armor
-
isToolApplicable
public static boolean isToolApplicable(org.bukkit.Material toolMaterial, org.bukkit.Material targetMaterial) Check if the material is usable via right-click on the target material. Returns false if the target material cannot be modified by the provided tool, or of the provided tool material isn't a tool material.- Parameters:
toolMaterial
- the tool material being usedtargetMaterial
- the target material to check- Returns:
- true if tool has an interact function with this material
-
isFire
public static boolean isFire(org.bukkit.Material type) -
isWaxedCopper
public static boolean isWaxedCopper(org.bukkit.Material type) -
isUnwaxedCopper
public static boolean isUnwaxedCopper(org.bukkit.Material type) -
isAmethystGrowth
public static boolean isAmethystGrowth(org.bukkit.Material mat) -
isSculkGrowth
public static boolean isSculkGrowth(org.bukkit.Material mat)
-