Fix potential issue
This commit is contained in:
		| @@ -2091,14 +2091,17 @@ public class DisguiseUtilities { | |||||||
|  |  | ||||||
|             if (playerName == null || !playerName.startsWith(namePrefix)) { |             if (playerName == null || !playerName.startsWith(namePrefix)) { | ||||||
|                 String nameSuffix = "" + ChatColor.RESET; |                 String nameSuffix = "" + ChatColor.RESET; | ||||||
|  |                 int maxLength = namePrefix.length() + nameSuffix.length(); | ||||||
|  |  | ||||||
|                 for (int i = 0; i < 1000; i++) { |                 for (int i = 0; i < 1000; i++) { | ||||||
|                     String testName = namePrefix + colorize(encode(getRandom().nextInt(Integer.MAX_VALUE))) + nameSuffix; |                     String tName = colorize(encode(getRandom().nextInt(Integer.MAX_VALUE))); | ||||||
|  |  | ||||||
|                     if (testName.length() > 16) { |                     if (tName.length() > maxLength) { | ||||||
|                         break; |                         tName = tName.substring(0, maxLength); | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|  |                     String testName = namePrefix + tName + nameSuffix; | ||||||
|  |  | ||||||
|                     if (!isValidPlayerName(board, testName)) { |                     if (!isValidPlayerName(board, testName)) { | ||||||
|                         continue; |                         continue; | ||||||
|                     } |                     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user