Class RGBAColorWrapper
java.lang.Object
de.eldoria.jacksonbukkit.entities.RGBColorWrapper
de.eldoria.jacksonbukkit.entities.RGBAColorWrapper
Class for wrapping a
Color
.
It also allows transformation to hex code and parsing of hex code.
This class is used on Paper Servers starting from 1.19 where alpha was introduced to colors.
-
Constructor Summary
ConstructorDescriptionRGBAColorWrapper
(int red, int green, int blue, int alpha) Create a new color wrapper for RGBA colors -
Method Summary
Modifier and TypeMethodDescriptionint
alpha()
Alpha value of the colorasHex()
Get the string as hex string with RGBA.boolean
int
hashCode()
static RGBAColorWrapper
Create a newRGBAColorWrapper
based on a hex string with RGBA or RGB.static RGBAColorWrapper
Create a newRGBAColorWrapper
based on aColor
.Constructs a new color instance based on wrapper values.toString()
Methods inherited from class de.eldoria.jacksonbukkit.entities.RGBColorWrapper
blue, green, red
-
Constructor Details
-
RGBAColorWrapper
public RGBAColorWrapper(int red, int green, int blue, int alpha) Create a new color wrapper for RGBA colors- Parameters:
red
- red valuegreen
- green valueblue
- blue valuealpha
- alpha value
-
-
Method Details
-
of
Create a newRGBAColorWrapper
based on aColor
.- Parameters:
color
- color instance- Returns:
- new
RGBAColorWrapper
instance
-
of
Create a newRGBAColorWrapper
based on a hex string with RGBA or RGB.- Parameters:
hex
- color as hex string- Returns:
- new
RGBAColorWrapper
instance
-
asHex
Get the string as hex string with RGBA.- Overrides:
asHex
in classRGBColorWrapper
- Returns:
- hex color as RGBA
-
toBukkitColor
Constructs a new color instance based on wrapper values.- Overrides:
toBukkitColor
in classRGBColorWrapper
- Returns:
- new color instance
-
alpha
public int alpha()Alpha value of the color- Returns:
- alpha
-
equals
- Overrides:
equals
in classRGBColorWrapper
-
hashCode
public int hashCode()- Overrides:
hashCode
in classRGBColorWrapper
-
toString
- Overrides:
toString
in classRGBColorWrapper
-