Class ChatUtils

java.lang.Object
com.avrix.api.server.ChatUtils

public class ChatUtils extends Object
A set of tools for chat management
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    White space symbol, used to separate words after applying color, etc. to it.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getColorCode(float r, float g, float b)
    Getting the color code for coloring a chat message
    static String
    getColorCode(int r, int g, int b)
    Getting the color code for coloring a chat message
    static String
    getColorCode(zombie.core.Color color)
    Getting the color code for coloring a chat message
    static void
    Sending a chat message to administrators
    static void
    Sending a message to a general chat for all users
    static void
    sendMessageToPlayer(zombie.core.raknet.UdpConnection playerConnection, String text)
    Sending a chat message to a specific user

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SPACE_SYMBOL

      public static final String SPACE_SYMBOL
      White space symbol, used to separate words after applying color, etc. to it.
      See Also:
  • Constructor Details

    • ChatUtils

      public ChatUtils()
  • Method Details

    • getColorCode

      public static String getColorCode(float r, float g, float b)
      Getting the color code for coloring a chat message
      Parameters:
      r - Red color component in the range 0.0 to 1.0.
      g - The green color component in the range 0.0 to 1.0.
      b - The blue component in the range 0.0 to 1.0.
      Returns:
      Color code in RGB format.
    • getColorCode

      public static String getColorCode(int r, int g, int b)
      Getting the color code for coloring a chat message
      Parameters:
      r - Red color component in the range 0 to 255.
      g - The green color component in the range 0 to 255.
      b - The blue component in the range 0 to 255.
      Returns:
      Color code in RGB format.
    • getColorCode

      public static String getColorCode(zombie.core.Color color)
      Getting the color code for coloring a chat message
      Parameters:
      color - Color object.
      Returns:
      Color code in RGB format.
    • sendMessageToAll

      public static void sendMessageToAll(String text)
      Sending a message to a general chat for all users
      Parameters:
      text - Message text
    • sendMessageToPlayer

      public static void sendMessageToPlayer(zombie.core.raknet.UdpConnection playerConnection, String text)
      Sending a chat message to a specific user
      Parameters:
      playerConnection - player connection
      text - Message text
    • sendMessageToAdmins

      public static void sendMessageToAdmins(String text)
      Sending a chat message to administrators
      Parameters:
      text - Message text