Package tk.airshipcraft.commonlib.utils
Class BlockUtils
java.lang.Object
tk.airshipcraft.commonlib.utils.BlockUtils
Utility class for categorizing different types of Minecraft blocks.
Allows for easy identification of block types such as logs, stones, planks, etc.
- Since:
- 2023-11-28
- Version:
- 1.0.0
- Author:
- notzune
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing different types of Minecraft blocks grouped by category. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BlockUtils.BlockType
getBlockType
(org.bukkit.Material material) Retrieves the block type of a given material.static Set<org.bukkit.Material>
Retrieves all materials associated with a given block type.static boolean
isCandle
(org.bukkit.Material material) Checks if a material is a candle agnostic of its color.static boolean
isLeaf
(org.bukkit.Material material) Checks if a material is a leaf.static boolean
isLog
(org.bukkit.Material material) Checks if a material is a log agnostic of whether it is stripped or not.static boolean
isPlank
(org.bukkit.Material material) Checks if a material is a plank.static boolean
isSign
(org.bukkit.Material material) Checks if a material is a sign agnostic if it is a wall sign or not.static boolean
isStone
(org.bukkit.Material material) Checks if a material is a stone type.static boolean
isWallSign
(org.bukkit.Material material) Checks if a material is a wall sign.static boolean
isWood
(org.bukkit.Material material) Checks if a material is wood agnostic of whether it is stripped or not.
-
Constructor Details
-
BlockUtils
public BlockUtils()
-
-
Method Details
-
getBlockType
Retrieves the block type of a given material.- Parameters:
material
- The material whose block type is to be determined.- Returns:
- The block type of the material, or null if the material does not have a mapped block type.
-
getMaterialsFromType
Retrieves all materials associated with a given block type.- Parameters:
type
- The block type for which materials are to be retrieved.- Returns:
- A set of materials associated with the specified block type.
-
isLog
public static boolean isLog(org.bukkit.Material material) Checks if a material is a log agnostic of whether it is stripped or not.- Parameters:
material
- The material to check.- Returns:
- true if the material is any type of log, false otherwise.
-
isWood
public static boolean isWood(org.bukkit.Material material) Checks if a material is wood agnostic of whether it is stripped or not.- Parameters:
material
- The material to check.- Returns:
- true if the material is any type of log, false otherwise.
-
isPlank
public static boolean isPlank(org.bukkit.Material material) Checks if a material is a plank.- Parameters:
material
- The material to check.- Returns:
- true if the material is any type of plank, false otherwise.
-
isLeaf
public static boolean isLeaf(org.bukkit.Material material) Checks if a material is a leaf.- Parameters:
material
- The material to check.- Returns:
- true if the material is any type of leaf, false otherwise.
-
isStone
public static boolean isStone(org.bukkit.Material material) Checks if a material is a stone type. Includes granite, diorite, and andesite.- Parameters:
material
- The material to check.- Returns:
- true if the material is any type of stone, false otherwise.
-
isCandle
public static boolean isCandle(org.bukkit.Material material) Checks if a material is a candle agnostic of its color.- Parameters:
material
- The material to check.- Returns:
- true if the material is any type of candle, false otherwise.
-
isWallSign
public static boolean isWallSign(org.bukkit.Material material) Checks if a material is a wall sign.- Parameters:
material
- The material to check.- Returns:
- true if the material is any type of wall sign, false otherwise.
-
isSign
public static boolean isSign(org.bukkit.Material material) Checks if a material is a sign agnostic if it is a wall sign or not.- Parameters:
material
- The material to check.- Returns:
- true if the material is any type of sign, false otherwise.
-