mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
Better validate static ChatColor methods
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
04ff31073b
commit
b43e5e0738
1 changed files with 4 additions and 0 deletions
|
@ -214,6 +214,8 @@ public enum ChatColor {
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
|
public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
|
||||||
|
Validate.notNull(textToTranslate, "Cannot translate null text");
|
||||||
|
|
||||||
char[] b = textToTranslate.toCharArray();
|
char[] b = textToTranslate.toCharArray();
|
||||||
for (int i = 0; i < b.length - 1; i++) {
|
for (int i = 0; i < b.length - 1; i++) {
|
||||||
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) {
|
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) {
|
||||||
|
@ -232,6 +234,8 @@ public enum ChatColor {
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String getLastColors(@NotNull String input) {
|
public static String getLastColors(@NotNull String input) {
|
||||||
|
Validate.notNull(input, "Cannot get last colors from null text");
|
||||||
|
|
||||||
String result = "";
|
String result = "";
|
||||||
int length = input.length();
|
int length = input.length();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue