java.lang.Object
io.github.dexrnzacattack.rrdiscordbridge.helpers.ChatHelper

public class ChatHelper extends Object
Provides basic utils when working with chat messages
  • Field Details

    • allowedCharacters

      public static String allowedCharacters
      Characters that can be displayed in-game
  • Constructor Details

    • ChatHelper

      public ChatHelper()
  • Method Details

    • readFontTxt

      public static String readFontTxt()
      Reads the font.txt file and returns the contents
      Returns:
      The contents of font.txt
    • isAllowedCharacter

      public static boolean isAllowedCharacter(char character)
      Checks if a character is allowed to be used in Minecraft
      Returns:
      true if the character is present in font.txt
    • filterText

      public static String filterText(String str, boolean allowSpecial, char replacement)
      Filters the text by replacing disallowed chars with replacement

      If allowSpecial is false, then all instances of '§' and newline chars will be replaced with replacement

      § is used for Minecraft color codes which might be annoying to other players that are trying to read the messages

      Parameters:
      str - The string to filter
      allowSpecial - Whether to remove newlines and '§'
      replacement - What char to replace disallowed characters with
      Returns:
      The filtered string