Fix potential issue
This commit is contained in:
parent
b5fb5054a2
commit
95b3d9f231
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user