Class ChatHelper
java.lang.Object
io.github.dexrnzacattack.rrdiscordbridge.helpers.ChatHelper
Provides basic utils when working with chat messages
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
filterText
(String str, boolean allowSpecial, char replacement) Filters the text by replacing disallowed chars withreplacement
static boolean
isAllowedCharacter
(char character) Checks if a character is allowed to be used in Minecraftstatic String
Reads the font.txt file and returns the contents
-
Field Details
-
allowedCharacters
Characters that can be displayed in-game
-
-
Constructor Details
-
ChatHelper
public ChatHelper()
-
-
Method Details
-
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
Filters the text by replacing disallowed chars withreplacement
If
allowSpecial
is false, then all instances of'§'
and newline chars will be replaced withreplacement
§
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 filterallowSpecial
- Whether to remove newlines and'§'
replacement
- What char to replace disallowed characters with- Returns:
- The filtered string
-