Class ColorUtils

java.lang.Object
me.tippie.tippieutils.v1_2_0.functions.ColorUtils

public class ColorUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.md_5.bungee.api.chat.TextComponent
    findComponent​(net.md_5.bungee.api.chat.TextComponent[] message, String query)
    Find the text component instance that contains the given query string.
    static net.md_5.bungee.api.chat.TextComponent[]
    replace​(net.md_5.bungee.api.chat.TextComponent[] message, String old, net.md_5.bungee.api.chat.TextComponent[] replacement)
    Replaces text in a TextComponent array that match the given input string with the replacement TextComponent array.
    static net.md_5.bungee.api.chat.TextComponent[]
    replace​(net.md_5.bungee.api.chat.TextComponent[] message, Pattern pattern, net.md_5.bungee.api.chat.TextComponent[] replacement)
    Replaces text in a TextComponent array that match the given input string with the replacement TextComponent array.
    static void
    setColors​(net.md_5.bungee.api.ChatColor color, net.md_5.bungee.api.chat.TextComponent... components)
    Set the colour of all text components in the given array.
    static net.md_5.bungee.api.chat.TextComponent[]
    translateColorCodes​(char character, String message)
    Translates color codes in the given string to the given color using text components.
    static net.md_5.bungee.api.chat.TextComponent[]
    translateColorCodes​(char character, net.md_5.bungee.api.chat.TextComponent message)
    Translates color codes in the given string to the given color using text components.
    static net.md_5.bungee.api.chat.TextComponent[]
    translateColorCodes​(char character, net.md_5.bungee.api.chat.TextComponent[] message)
    Translates color codes in the given string to the given color using text components.
    static net.md_5.bungee.api.chat.TextComponent[]
    translateColorCodes​(char character, net.md_5.bungee.api.chat.TextComponent[] message, boolean onlyLinkify)
    Translates color codes in the given string to the given color using text components.
    static net.md_5.bungee.api.chat.TextComponent[]
    translateColorCodes​(String character, String message)
    Translates color codes in the given string to the given color using text components.
    static net.md_5.bungee.api.chat.TextComponent[]
    translateColorCodes​(String character, net.md_5.bungee.api.chat.TextComponent message, boolean onlyLinkify)
    Translates color codes in the given string to the given color using text components.
    static net.md_5.bungee.api.chat.TextComponent[]
    translateColorCodes​(String character, net.md_5.bungee.api.chat.TextComponent message, boolean onlyLinkify, String hoverText)
    Translates color codes in the given string to the given color using text components.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ColorUtils

      public ColorUtils()
  • Method Details

    • translateColorCodes

      public static net.md_5.bungee.api.chat.TextComponent[] translateColorCodes(String character, String message)
      Translates color codes in the given string to the given color using text components. Links are also made clickable and given a hover text message. This function also supports hex colour if the server running it supports hex colours. There are also named colours where the colours are as follows:
      • 0 - black
      • 1 - dark_blue
      • 2 - dark_green
      • 3 - dark_aqua
      • 4 - dark_red
      • 5 - dark_purple
      • 6 - gold
      • 7 - gray
      • 8 - dark_gray
      • 9 - blue
      • a - green
      • b - aqua
      • c - red
      • d - light_purple
      • e - yellow
      • f - white
      • k - obfuscated
      • l - bold
      • m - italic
      • n - underlined
      • o - strikethrough
      • r - reset
      Parameters:
      character - The character prepended to the colour code.
      message - The message to translate.
      Returns:
      The array of text components that represent the translated message.
    • translateColorCodes

      public static net.md_5.bungee.api.chat.TextComponent[] translateColorCodes(String character, net.md_5.bungee.api.chat.TextComponent message, boolean onlyLinkify)
      Translates color codes in the given string to the given color using text components. Links are also made clickable and given a hover text message. This function also supports hex colour if the server running it supports hex colours. There are also named colours where the colours are as follows:
      • 0 - black
      • 1 - dark_blue
      • 2 - dark_green
      • 3 - dark_aqua
      • 4 - dark_red
      • 5 - dark_purple
      • 6 - gold
      • 7 - gray
      • 8 - dark_gray
      • 9 - blue
      • a - green
      • b - aqua
      • c - red
      • d - light_purple
      • e - yellow
      • f - white
      • k - obfuscated
      • l - bold
      • m - italic
      • n - underlined
      • o - strikethrough
      • r - reset
      Parameters:
      character - The character prepended to the colour code.
      message - The message to translate.
      onlyLinkify - Whether to only linkify the message.
      Returns:
      The array of text components that represent the translated message.
    • translateColorCodes

      public static net.md_5.bungee.api.chat.TextComponent[] translateColorCodes(String character, net.md_5.bungee.api.chat.TextComponent message, boolean onlyLinkify, String hoverText)
      Translates color codes in the given string to the given color using text components. Links are also made clickable and given a hover text message. This function also supports hex colour if the server running it supports hex colours. There are also named colours where the colours are as follows:
      • 0 - black
      • 1 - dark_blue
      • 2 - dark_green
      • 3 - dark_aqua
      • 4 - dark_red
      • 5 - dark_purple
      • 6 - gold
      • 7 - gray
      • 8 - dark_gray
      • 9 - blue
      • a - green
      • b - aqua
      • c - red
      • d - light_purple
      • e - yellow
      • f - white
      • k - obfuscated
      • l - bold
      • m - italic
      • n - underlined
      • o - strikethrough
      • r - reset
      Parameters:
      character - The character prepended to the colour code.
      message - The message to translate.
      onlyLinkify - Whether to only linkify the message.
      hoverText - The hover text to use for the links, use {url} to replace it with the url.
      Returns:
      The array of text components that represent the translated message.
    • translateColorCodes

      public static net.md_5.bungee.api.chat.TextComponent[] translateColorCodes(char character, String message)
      Translates color codes in the given string to the given color using text components. Links are also made clickable and given a hover text message. This function also supports hex colour if the server running it supports hex colours. There are also named colours where the colours are as follows:
      • 0 - black
      • 1 - dark_blue
      • 2 - dark_green
      • 3 - dark_aqua
      • 4 - dark_red
      • 5 - dark_purple
      • 6 - gold
      • 7 - gray
      • 8 - dark_gray
      • 9 - blue
      • a - green
      • b - aqua
      • c - red
      • d - light_purple
      • e - yellow
      • f - white
      • k - obfuscated
      • l - bold
      • m - italic
      • n - underlined
      • o - strikethrough
      • r - reset
      Parameters:
      character - The character prepended to the colour code.
      message - The message to translate.
      Returns:
      The array of text components that represent the translated message.
    • translateColorCodes

      public static net.md_5.bungee.api.chat.TextComponent[] translateColorCodes(char character, net.md_5.bungee.api.chat.TextComponent message)
      Translates color codes in the given string to the given color using text components. Links are also made clickable and given a hover text message. This function also supports hex colour if the server running it supports hex colours. There are also named colours where the colours are as follows:
      • 0 - black
      • 1 - dark_blue
      • 2 - dark_green
      • 3 - dark_aqua
      • 4 - dark_red
      • 5 - dark_purple
      • 6 - gold
      • 7 - gray
      • 8 - dark_gray
      • 9 - blue
      • a - green
      • b - aqua
      • c - red
      • d - light_purple
      • e - yellow
      • f - white
      • k - obfuscated
      • l - bold
      • m - italic
      • n - underlined
      • o - strikethrough
      • r - reset
      Parameters:
      character - The character prepended to the colour code.
      message - The message to translate.
      Returns:
      The array of text components that represent the translated message.
    • replace

      public static net.md_5.bungee.api.chat.TextComponent[] replace(net.md_5.bungee.api.chat.TextComponent[] message, String old, net.md_5.bungee.api.chat.TextComponent[] replacement)
      Replaces text in a TextComponent array that match the given input string with the replacement TextComponent array.
      Parameters:
      message - The message to replace in.
      old - The string that should be replaced
      replacement - The replacement.
      Returns:
      The new TextComponent array where any occurrence of old is replaced with the replacement.
    • replace

      public static net.md_5.bungee.api.chat.TextComponent[] replace(net.md_5.bungee.api.chat.TextComponent[] message, Pattern pattern, net.md_5.bungee.api.chat.TextComponent[] replacement)
      Replaces text in a TextComponent array that match the given input string with the replacement TextComponent array.
      Parameters:
      message - The message to replace in.
      pattern - The regex pattern that should be replaced.
      replacement - The replacement.
      Returns:
      The new TextComponent array where any match with the pattern is replaced with the replacement.
    • findComponent

      public static net.md_5.bungee.api.chat.TextComponent findComponent(net.md_5.bungee.api.chat.TextComponent[] message, String query)
      Find the text component instance that contains the given query string.
      Parameters:
      message - The TextComponent array to search in.
      query - The query string to search for.
      Returns:
      The first TextComponent instance that contains the query string.
    • translateColorCodes

      public static net.md_5.bungee.api.chat.TextComponent[] translateColorCodes(char character, net.md_5.bungee.api.chat.TextComponent[] message)
      Translates color codes in the given string to the given color using text components. Links are also made clickable and given a hover text message. This function also supports hex colour if the server running it supports hex colours. There are also named colours where the colours are as follows:
      • 0 - black
      • 1 - dark_blue
      • 2 - dark_green
      • 3 - dark_aqua
      • 4 - dark_red
      • 5 - dark_purple
      • 6 - gold
      • 7 - gray
      • 8 - dark_gray
      • 9 - blue
      • a - green
      • b - aqua
      • c - red
      • d - light_purple
      • e - yellow
      • f - white
      • k - obfuscated
      • l - bold
      • m - italic
      • n - underlined
      • o - strikethrough
      • r - reset
      Parameters:
      character - The character prepended to the colour code.
      message - The message to translate.
      Returns:
      The array of text components that represent the translated message.
    • translateColorCodes

      public static net.md_5.bungee.api.chat.TextComponent[] translateColorCodes(char character, net.md_5.bungee.api.chat.TextComponent[] message, boolean onlyLinkify)
      Translates color codes in the given string to the given color using text components. Links are also made clickable and given a hover text message. This function also supports hex colour if the server running it supports hex colours. There are also named colours where the colours are as follows:
      • 0 - black
      • 1 - dark_blue
      • 2 - dark_green
      • 3 - dark_aqua
      • 4 - dark_red
      • 5 - dark_purple
      • 6 - gold
      • 7 - gray
      • 8 - dark_gray
      • 9 - blue
      • a - green
      • b - aqua
      • c - red
      • d - light_purple
      • e - yellow
      • f - white
      • k - obfuscated
      • l - bold
      • m - italic
      • n - underlined
      • o - strikethrough
      • r - reset
      Parameters:
      character - The character prepended to the colour code.
      message - The message to translate.
      onlyLinkify - Whether to only make links clickable and not colour the rest.
      Returns:
      The array of text components that represent the translated message.
    • setColors

      @Contract(mutates="param2") public static void setColors(net.md_5.bungee.api.ChatColor color, net.md_5.bungee.api.chat.TextComponent... components)
      Set the colour of all text components in the given array.
      Parameters:
      color - The colour to set the text components to.
      components - The components to set the colour of.