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
ConstructorsConstructorDescriptionRGBAColorWrapper(int red, int green, int blue, int alpha) Create a new color wrapper for RGBA colors -
Method Summary
Modifier and TypeMethodDescriptionintalpha()Alpha value of the colorasHex()Get the string as hex string with RGBA.booleaninthashCode()static RGBAColorWrapperCreate a newRGBAColorWrapperbased on a hex string with RGBA or RGB.static RGBAColorWrapperCreate a newRGBAColorWrapperbased 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 newRGBAColorWrapperbased on aColor.- Parameters:
color- color instance- Returns:
- new
RGBAColorWrapperinstance
-
of
Create a newRGBAColorWrapperbased on a hex string with RGBA or RGB.- Parameters:
hex- color as hex string- Returns:
- new
RGBAColorWrapperinstance
-
asHex
Get the string as hex string with RGBA.- Overrides:
asHexin classRGBColorWrapper- Returns:
- hex color as RGBA
-
toBukkitColor
Constructs a new color instance based on wrapper values.- Overrides:
toBukkitColorin classRGBColorWrapper- Returns:
- new color instance
-
alpha
public int alpha()Alpha value of the color- Returns:
- alpha
-
equals
- Overrides:
equalsin classRGBColorWrapper
-
hashCode
public int hashCode()- Overrides:
hashCodein classRGBColorWrapper
-
toString
- Overrides:
toStringin classRGBColorWrapper
-