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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.Particle.DustOptionscreateDustOptionsFromHex(String hexColor, float size) Creates aParticle.DustOptionsobject using a hex color code.static org.bukkit.ColorGets theColorcorresponding to the given color name.static org.bukkit.ColorgetColorFromHex(String hex) Parses a hex color code to aColorfor use with particle dust options.
-
Method Details
-
getColor
Gets theColorcorresponding to the given color name.- Parameters:
colorName- The name of the color as a string.- Returns:
- The
Colorcorresponding to the given name, ornullif no match is found.
-
getColorFromHex
Parses a hex color code to aColorfor 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
Colorcorresponding to the hex color code, ornullif the code is invalid.
-
createDustOptionsFromHex
Creates aParticle.DustOptionsobject 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.DustOptionsobject with the specified color and size, ornullif the color code is invalid.
-