Enum Class SkriptColor

java.lang.Object
java.lang.Enum<SkriptColor>
ch.njol.skript.util.SkriptColor
All Implemented Interfaces:
Color, YggdrasilSerializable, YggdrasilSerializable.YggdrasilExtendedSerializable, Serializable, Comparable<SkriptColor>, Constable

public enum SkriptColor extends Enum<SkriptColor> implements Color
  • Enum Constant Details

  • Method Details

    • values

      public static SkriptColor[] 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

      public static SkriptColor valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • asBukkitColor

      public org.bukkit.Color asBukkitColor()
      Description copied from interface: Color
      Gets Bukkit color representing this color.
      Specified by:
      asBukkitColor in interface Color
      Returns:
      Bukkit color.
    • asDyeColor

      public org.bukkit.DyeColor asDyeColor()
      Description copied from interface: Color
      Gets Bukkit dye color representing this color, if one exists.
      Specified by:
      asDyeColor in interface Color
      Returns:
      Dye color or null.
    • getName

      public String getName()
      Specified by:
      getName in interface Color
      Returns:
      Name of the color.
    • serialize

      public Fields serialize() throws NotSerializableException
      Description copied from interface: YggdrasilSerializable.YggdrasilExtendedSerializable
      Serialises 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:
      serialize in interface YggdrasilSerializable.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

      public void deserialize(@NotNull @NotNull Fields fields) throws StreamCorruptedException
      Description copied from interface: YggdrasilSerializable.YggdrasilExtendedSerializable
      Deserializes 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:
      deserialize in interface YggdrasilSerializable.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 by YggdrasilSerializable.YggdrasilExtendedSerializable.serialize() or Yggdrasil's default serialisation.
    • getFormattedChat

      public String getFormattedChat()
    • getAdjective

      @Nullable public @Nullable Adjective getAdjective()
    • asChatColor

      public org.bukkit.ChatColor asChatColor()
    • getWoolData

      @Deprecated public byte getWoolData()
      Deprecated.
    • getDyeData

      @Deprecated public byte getDyeData()
      Deprecated.
    • fromName

      @Nullable public static @Nullable SkriptColor fromName(String name)
      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

      public static SkriptColor fromDyeColor(org.bukkit.DyeColor dye)
      Parameters:
      dye - DyeColor to match against a defined Skript Color.
      Returns:
      Skript Color if matched up with the defined DyeColor
    • fromBukkitColor

      public static SkriptColor fromBukkitColor(org.bukkit.Color color)
    • fromDyeData

      @Deprecated @Nullable public static @Nullable SkriptColor fromDyeData(short data)
      Deprecated.
      Magic numbers
      Parameters:
      data - short to match against a defined Skript Color.
      Returns:
      Skript Color if matched up with the defined short
    • fromWoolData

      @Deprecated @Nullable public static @Nullable SkriptColor fromWoolData(short data)
      Deprecated.
      Magic numbers
      Parameters:
      data - short to match against a defined Skript Color.
      Returns:
      Skript Color if matched up with the defined short
    • replaceColorChar

      public static String replaceColorChar(String s)
      Replace chat color character '§' with 'invalid input: '&'' This is an alternative method to ChatColor.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
    • toString

      public String toString()
      Overrides:
      toString in class Enum<SkriptColor>