34 lines
1.1 KiB
Java
34 lines
1.1 KiB
Java
package net.limework.gal.utils;
|
|
|
|
import net.limework.gal.utils.config.Configuration;
|
|
|
|
public class PlayerNamesUtils {
|
|
|
|
|
|
public static boolean isCrackedPlayer(String username, Configuration configuration) {
|
|
if (configuration.useTheContainMethod()) {
|
|
return username.contains(configuration.getCrackedCharString());
|
|
} else {
|
|
return username.charAt(0) == configuration.getCrackedChar();
|
|
}
|
|
}
|
|
|
|
|
|
public static String getCorrectCrackedUsername(String username, Configuration configuration) {
|
|
if (configuration.doReplaceSpacesWithUnderscore()) {
|
|
username = username.replace(" ", "_");
|
|
}
|
|
if (username.length() >= 16) {
|
|
username = username.substring(0, 15);
|
|
}
|
|
if (configuration.useTheContainMethod() && !username.contains(configuration.getCrackedCharString())) {
|
|
username = configuration.getCrackedChar() + username;
|
|
} else if (username.charAt(0) != configuration.getCrackedChar()) {
|
|
username = configuration.getCrackedChar() + username;
|
|
}
|
|
return username;
|
|
}
|
|
|
|
|
|
}
|