Package com.ranull.graves.util
Class ColorUtil
java.lang.Object
com.ranull.graves.util.ColorUtil
Utility class for handling color operations, including particle dust colors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.Particle.DustOptions
createDustOptionsFromHex
(String hexColor, float size) Creates aParticle.DustOptions
object using a hex color code.static org.bukkit.Color
Gets theColor
corresponding to the given color name.static org.bukkit.Color
getColorFromHex
(String hex) Parses a hex color code to aColor
for use with particle dust options.
-
Constructor Details
-
ColorUtil
private ColorUtil()
-
-
Method Details
-
getColor
Gets theColor
corresponding to the given color name.- Parameters:
colorName
- The name of the color as a string.- Returns:
- The
Color
corresponding to the given name, ornull
if no match is found.
-
getColorFromHex
Parses a hex color code to aColor
for use with particle dust options.Minecraft 1.16+ supports hex color codes for particle dust. This method parses a hex color code in the format #RRGGBB and returns the corresponding
Color
.- Parameters:
hex
- The hex color code as a string (e.g., "#FF5733").- Returns:
- The
Color
corresponding to the hex color code, ornull
if the code is invalid.
-
createDustOptionsFromHex
Creates aParticle.DustOptions
object using a hex color code.- Parameters:
hexColor
- The hex color code as a string (e.g., "#FF5733").size
- The size of the dust particle.- Returns:
- A
Particle.DustOptions
object with the specified color and size, ornull
if the color code is invalid.
-