Better validate static ChatColor methods

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
Bukkit/Spigot 2019-05-03 15:51:10 -04:00
parent 04ff31073b
commit b43e5e0738

View file

@ -214,6 +214,8 @@ public enum ChatColor {
*/
@NotNull
public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
Validate.notNull(textToTranslate, "Cannot translate null text");
char[] b = textToTranslate.toCharArray();
for (int i = 0; i < b.length - 1; i++) {
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) {
@ -232,6 +234,8 @@ public enum ChatColor {
*/
@NotNull
public static String getLastColors(@NotNull String input) {
Validate.notNull(input, "Cannot get last colors from null text");
String result = "";
int length = input.length();