Package ch.njol.skript.util
Enum Class SkriptColor
- All Implemented Interfaces:
Color,YggdrasilSerializable,YggdrasilSerializable.YggdrasilExtendedSerializable,Serializable,Comparable<SkriptColor>,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>Nested classes/interfaces inherited from interface ch.njol.yggdrasil.YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.ColorGets Bukkit color representing this color.org.bukkit.ChatColororg.bukkit.DyeColorGets Bukkit dye color representing this color, if one exists.voiddeserialize(@NotNull Fields fields) Deserializes this object.static SkriptColorfromBukkitColor(org.bukkit.Color color) static @Nullable SkriptColorfromColorChar(char character) Retrieve aSkriptColorcorrelating to the color character fromcharacterstatic SkriptColorfromDyeColor(org.bukkit.DyeColor dye) static @Nullable SkriptColorfromDyeData(short data) Deprecated, for removal: This API element is subject to removal in a future version.Magic numbersstatic @Nullable SkriptColorstatic @Nullable SkriptColorfromWoolData(short data) Deprecated, for removal: This API element is subject to removal in a future version.Magic numbers@Nullable AdjectiveintgetAlpha()intgetBlue()byteDeprecated, for removal: This API element is subject to removal in a future version.intgetGreen()getName()intgetRed()byteDeprecated, for removal: This API element is subject to removal in a future version.static StringReplace chat color character '§' with 'invalid input: '&'' This is an alternative method toChatColor.stripColor(String)But does not strip the color code.Serialises this object.toString()static SkriptColorReturns the enum constant of this class with the specified name.static SkriptColor[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BLACK
-
DARK_GREY
-
LIGHT_GREY
-
WHITE
-
DARK_BLUE
-
BROWN
-
DARK_CYAN
-
LIGHT_CYAN
-
DARK_GREEN
-
LIGHT_GREEN
-
YELLOW
-
ORANGE
-
DARK_RED
-
LIGHT_RED
-
DARK_PURPLE
-
LIGHT_PURPLE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
asBukkitColor
public org.bukkit.Color asBukkitColor()Description copied from interface:ColorGets Bukkit color representing this color.- Specified by:
asBukkitColorin interfaceColor- Returns:
- Bukkit color.
-
getAlpha
public int getAlpha() -
getRed
public int getRed() -
getGreen
public int getGreen() -
getBlue
public int getBlue() -
asDyeColor
public 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
-
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.
-
getFormattedChat
-
getAdjective
-
asChatColor
public org.bukkit.ChatColor asChatColor() -
getWoolData
Deprecated, for removal: This API element is subject to removal in a future version. -
getDyeData
Deprecated, for removal: This API element is subject to removal in a future version. -
fromName
- Parameters:
name- The String name of the color defined by Skript's .lang files.- Returns:
- Skript Color if matched up with the defined name
-
fromDyeColor
- Parameters:
dye- DyeColor to match against a defined Skript Color.- Returns:
- Skript Color if matched up with the defined DyeColor
-
fromBukkitColor
-
fromDyeData
@Deprecated(since="2.3.6", forRemoval=true) @Nullable public static @Nullable SkriptColor fromDyeData(short data) Deprecated, for removal: This API element is subject to removal in a future version.Magic numbers- Parameters:
data- short to match against a defined Skript Color.- Returns:
- Skript Color if matched up with the defined short
-
fromWoolData
@Deprecated(since="2.3.6", forRemoval=true) @Nullable public static @Nullable SkriptColor fromWoolData(short data) Deprecated, for removal: This API element is subject to removal in a future version.Magic numbers- Parameters:
data- short to match against a defined Skript Color.- Returns:
- Skript Color if matched up with the defined short
-
replaceColorChar
Replace chat color character '§' with 'invalid input: '&'' This is an alternative method toChatColor.stripColor(String)But does not strip the color code.- Parameters:
s- string to replace chat color character of.- Returns:
- String with replaced chat color character
-
fromColorChar
Retrieve aSkriptColorcorrelating to the color character fromcharacter- Parameters:
character-- Returns:
- The resulting
SkriptColor
-
toString
- Overrides:
toStringin classEnum<SkriptColor>
-