Package ch.njol.skript.util
Class ColorRGB
java.lang.Object
ch.njol.skript.util.ColorRGB
- All Implemented Interfaces:
Color,YggdrasilSerializable,YggdrasilSerializable.YggdrasilExtendedSerializable
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.njol.yggdrasil.YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.ColorGets Bukkit color representing this color.@Nullable org.bukkit.DyeColorGets Bukkit dye color representing this color, if one exists.voiddeserialize(Fields fields) Deserializes this object.static @NotNull ColorRGBfromBukkitColor(org.bukkit.Color bukkit) Returns a ColorRGB object from a bukkit color.static @NotNull ColorRGBfromRGB(int red, int green, int blue) Returns a ColorRGB object from the provided arguments.static @NotNull ColorRGBfromRGBA(int red, int green, int blue, int alpha) Returns a ColorRGB object from the provided arguments.static @Nullable ColorRGBfromString(String string) intgetAlpha()intgetBlue()intgetGreen()getName()intgetRed()Serialises this object.
-
Constructor Details
-
ColorRGB
@Deprecated(since="2.10.0", forRemoval=true) @Internal public ColorRGB(int red, int green, int blue) Deprecated, for removal: This API element is subject to removal in a future version.Subject to being private in the future. UsefromRGB(int, int, int)This is to keep inline with other color classes. -
ColorRGB
Deprecated, for removal: This API element is subject to removal in a future version.Subject to being private in the future. UsefromBukkitColor(org.bukkit.Color)This is to keep inline with other color classes.
-
-
Method Details
-
fromRGBA
@Contract("_,_,_,_ -> new") @NotNull public static @NotNull ColorRGB fromRGBA(int red, int green, int blue, int alpha) Returns a ColorRGB object from the provided arguments. Versions lower than 1.19 will not support alpha values.- Parameters:
red- red value (0 to 255)green- green value (0 to 255)blue- blue value (0 to 255)alpha- alpha value (0 to 255)- Returns:
- ColorRGB
-
fromRGB
@Contract("_,_,_ -> new") @NotNull public static @NotNull ColorRGB fromRGB(int red, int green, int blue) Returns a ColorRGB object from the provided arguments.- Parameters:
red- red value (0 to 255)green- green value (0 to 255)blue- blue value (0 to 255)- Returns:
- ColorRGB
-
fromBukkitColor
@Contract("_ -> new") @NotNull public static @NotNull ColorRGB fromBukkitColor(org.bukkit.Color bukkit) Returns a ColorRGB object from a bukkit color.- Parameters:
bukkit- the bukkit color to replicate- Returns:
- ColorRGB
-
getAlpha
public int getAlpha() -
getRed
public int getRed() -
getGreen
public int getGreen() -
getBlue
public int getBlue() -
asBukkitColor
public org.bukkit.Color asBukkitColor()Description copied from interface:ColorGets Bukkit color representing this color.- Specified by:
asBukkitColorin interfaceColor- Returns:
- Bukkit color.
-
asDyeColor
@Nullable public @Nullable org.bukkit.DyeColor asDyeColor()Description copied from interface:ColorGets Bukkit dye color representing this color, if one exists.- Specified by:
asDyeColorin interfaceColor- Returns:
- Dye color or null.
-
getName
-
fromString
-
serialize
Description copied from interface:YggdrasilSerializable.YggdrasilExtendedSerializableSerialises this object. Only fields contained in the returned Fields object will be written to stream.You can use return new
Fields(this); to emulate the default behaviour.- Specified by:
serializein interfaceYggdrasilSerializable.YggdrasilExtendedSerializable- Returns:
- A Fields object containing all fields that should be written to stream
- Throws:
NotSerializableException- If this object or one of its fields is not serializable
-
deserialize
Description copied from interface:YggdrasilSerializable.YggdrasilExtendedSerializableDeserializes this object. No fields have been set when this method is called, use fields.setFields(this, yggdrasil) to set all compatible non-transient and non-static fields (and call incompatible/missing field handlers if applicable – this implies that errors will be thrown if the fields object is invalid).You can use fields.
setFields(this); to emulate the default behaviour.- Specified by:
deserializein interfaceYggdrasilSerializable.YggdrasilExtendedSerializable- Parameters:
fields- A Fields object containing all fields read from stream- Throws:
StreamCorruptedException- If the Fields object is invalid, i.e. was not written byYggdrasilSerializable.YggdrasilExtendedSerializable.serialize()or Yggdrasil's default serialisation.NotSerializableException
-