Always specify Locale on toLowerCase and toUpperCase usages, fixes AuthMe not working correctly on machines with turkish locale. ('I'.toLowerCase() => 'ı')
This commit is contained in:
@@ -21,6 +21,7 @@ import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -217,7 +218,7 @@ public class AuthMeApi {
|
||||
* @return true if player is registered, false otherwise
|
||||
*/
|
||||
public boolean isRegistered(String playerName) {
|
||||
String player = playerName.toLowerCase();
|
||||
String player = playerName.toLowerCase(Locale.ROOT);
|
||||
return dataSource.isAuthAvailable(player);
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ public class AuthMeApi {
|
||||
* @return true if the player was registered successfully
|
||||
*/
|
||||
public boolean registerPlayer(String playerName, String password) {
|
||||
String name = playerName.toLowerCase();
|
||||
String name = playerName.toLowerCase(Locale.ROOT);
|
||||
if (isRegistered(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import static fr.xephi.authme.command.FoundResultStatus.INCORRECT_ARGUMENTS;
|
||||
@@ -130,7 +131,7 @@ public class CommandMapper {
|
||||
}
|
||||
|
||||
private CommandDescription getBaseCommand(String label) {
|
||||
String baseLabel = label.toLowerCase();
|
||||
String baseLabel = label.toLowerCase(Locale.ROOT);
|
||||
if (baseLabel.startsWith("authme:")) {
|
||||
baseLabel = baseLabel.substring("authme:".length());
|
||||
}
|
||||
@@ -157,7 +158,7 @@ public class CommandMapper {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String label = parts.get(0).toLowerCase();
|
||||
final String label = parts.get(0).toLowerCase(Locale.ROOT);
|
||||
final int argumentCount = parts.size() - 1;
|
||||
|
||||
for (CommandDescription child : baseCommand.getChildren()) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Shows all accounts registered by the same IP address for the given player name or IP address.
|
||||
@@ -44,7 +45,7 @@ public class AccountsCommand implements ExecutableCommand {
|
||||
});
|
||||
} else {
|
||||
bukkitService.runTaskAsynchronously(() -> {
|
||||
PlayerAuth auth = dataSource.getAuth(playerName.toLowerCase());
|
||||
PlayerAuth auth = dataSource.getAuth(playerName.toLowerCase(Locale.ROOT));
|
||||
if (auth == null) {
|
||||
commonService.send(sender, MessageKey.UNKNOWN_USER);
|
||||
return;
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -71,7 +72,7 @@ public class ConverterCommand implements ExecutableCommand {
|
||||
private static Class<? extends Converter> getConverterClassFromArgs(List<String> arguments) {
|
||||
return arguments.isEmpty()
|
||||
? null
|
||||
: CONVERTERS.get(arguments.get(0).toLowerCase());
|
||||
: CONVERTERS.get(arguments.get(0).toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import javax.inject.Inject;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,7 @@ public class PurgeBannedPlayersCommand implements ExecutableCommand {
|
||||
Set<OfflinePlayer> bannedPlayers = bukkitService.getBannedPlayers();
|
||||
Set<String> namedBanned = new HashSet<>(bannedPlayers.size());
|
||||
for (OfflinePlayer offlinePlayer : bannedPlayers) {
|
||||
namedBanned.add(offlinePlayer.getName().toLowerCase());
|
||||
namedBanned.add(offlinePlayer.getName().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
purgeService.purgePlayers(sender, namedBanned, bannedPlayers.toArray(new OfflinePlayer[bannedPlayers.size()]));
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class PurgePlayerCommand implements ExecutableCommand {
|
||||
private void executeCommand(CommandSender sender, String name, String option) {
|
||||
if ("force".equals(option) || !dataSource.isAuthAvailable(name)) {
|
||||
OfflinePlayer offlinePlayer = bukkitService.getOfflinePlayer(name);
|
||||
purgeExecutor.executePurge(singletonList(offlinePlayer), singletonList(name.toLowerCase()));
|
||||
purgeExecutor.executePurge(singletonList(offlinePlayer), singletonList(name.toLowerCase(Locale.ROOT)));
|
||||
sender.sendMessage("Purged data for player " + name);
|
||||
} else {
|
||||
sender.sendMessage("This player is still registered! Are you sure you want to proceed? "
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Admin command to register a user.
|
||||
@@ -45,7 +46,7 @@ public class RegisterAdminCommand implements ExecutableCommand {
|
||||
// Get the player name and password
|
||||
final String playerName = arguments.get(0);
|
||||
final String playerPass = arguments.get(1);
|
||||
final String playerNameLowerCase = playerName.toLowerCase();
|
||||
final String playerNameLowerCase = playerName.toLowerCase(Locale.ROOT);
|
||||
|
||||
// Command logic
|
||||
ValidationResult passwordValidation = validationService.validatePassword(playerPass, playerName);
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
@@ -45,7 +46,7 @@ public class DebugCommand implements ExecutableCommand {
|
||||
if (arguments.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return getSections().get(arguments.get(0).toLowerCase());
|
||||
return getSections().get(arguments.get(0).toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
private void sendAvailableSections(CommandSender sender) {
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* The command for a player to change his password with.
|
||||
@@ -35,7 +36,7 @@ public class ChangePasswordCommand extends PlayerCommand {
|
||||
|
||||
@Override
|
||||
public void runCommand(Player player, List<String> arguments) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
|
||||
if (!playerCache.isAuthenticated(name)) {
|
||||
commonService.send(player, MessageKey.NOT_LOGGED_IN);
|
||||
|
||||
@@ -4,6 +4,7 @@ import fr.xephi.authme.initialization.HasCleanup;
|
||||
import fr.xephi.authme.util.expiring.ExpiringSet;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ProxySessionManager implements HasCleanup {
|
||||
@@ -21,7 +22,7 @@ public class ProxySessionManager implements HasCleanup {
|
||||
* @param name the player's name
|
||||
*/
|
||||
private void setActiveSession(String name) {
|
||||
activeProxySessions.add(name.toLowerCase());
|
||||
activeProxySessions.add(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -82,7 +83,7 @@ public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
||||
* @return true if the player has been verified, false otherwise
|
||||
*/
|
||||
private boolean isPlayerVerified(String name) {
|
||||
return verifiedPlayers.contains(name.toLowerCase());
|
||||
return verifiedPlayers.contains(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +93,7 @@ public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
||||
* @return true if the code exists, false otherwise
|
||||
*/
|
||||
public boolean hasCode(String name) {
|
||||
return (verificationCodes.get(name.toLowerCase()) != null);
|
||||
return (verificationCodes.get(name.toLowerCase(Locale.ROOT)) != null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +136,7 @@ public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
||||
final String email = emailResult.getValue();
|
||||
if (!Utils.isEmailEmpty(email)) {
|
||||
String code = RandomStringUtils.generateNum(6); // 6 digits code
|
||||
verificationCodes.put(name.toLowerCase(), code);
|
||||
verificationCodes.put(name.toLowerCase(Locale.ROOT), code);
|
||||
emailService.sendVerificationMail(name, email, code);
|
||||
}
|
||||
}
|
||||
@@ -150,7 +151,7 @@ public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
||||
*/
|
||||
public boolean checkCode(String name, String code) {
|
||||
boolean correct = false;
|
||||
if (code.equals(verificationCodes.get(name.toLowerCase()))) {
|
||||
if (code.equals(verificationCodes.get(name.toLowerCase(Locale.ROOT)))) {
|
||||
verify(name);
|
||||
correct = true;
|
||||
}
|
||||
@@ -163,7 +164,7 @@ public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
||||
* @param name the name of the player to generate a code for
|
||||
*/
|
||||
public void verify(String name) {
|
||||
verifiedPlayers.add(name.toLowerCase());
|
||||
verifiedPlayers.add(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +173,7 @@ public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
||||
* @param name the name of the player to generate a code for
|
||||
*/
|
||||
public void unverify(String name){
|
||||
verifiedPlayers.remove(name.toLowerCase());
|
||||
verifiedPlayers.remove(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ package fr.xephi.authme.data.auth;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
@@ -54,7 +55,7 @@ public class PlayerAuth {
|
||||
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname.toLowerCase();
|
||||
this.nickname = nickname.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
@@ -239,7 +240,7 @@ public class PlayerAuth {
|
||||
*/
|
||||
public PlayerAuth build() {
|
||||
PlayerAuth auth = new PlayerAuth();
|
||||
auth.nickname = checkNotNull(name).toLowerCase();
|
||||
auth.nickname = checkNotNull(name).toLowerCase(Locale.ROOT);
|
||||
auth.realName = Optional.ofNullable(realName).orElse("Player");
|
||||
auth.password = Optional.ofNullable(password).orElse(new HashedPassword(""));
|
||||
auth.totpKey = totpKey;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fr.xephi.authme.data.auth;
|
||||
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -20,7 +21,7 @@ public class PlayerCache {
|
||||
* @param auth the player auth object to save
|
||||
*/
|
||||
public void updatePlayer(PlayerAuth auth) {
|
||||
cache.put(auth.getNickname().toLowerCase(), auth);
|
||||
cache.put(auth.getNickname().toLowerCase(Locale.ROOT), auth);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,7 @@ public class PlayerCache {
|
||||
* @param user name of the player to remove
|
||||
*/
|
||||
public void removePlayer(String user) {
|
||||
cache.remove(user.toLowerCase());
|
||||
cache.remove(user.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +41,7 @@ public class PlayerCache {
|
||||
* @return true if player is logged in, false otherwise.
|
||||
*/
|
||||
public boolean isAuthenticated(String user) {
|
||||
return cache.containsKey(user.toLowerCase());
|
||||
return cache.containsKey(user.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,7 @@ public class PlayerCache {
|
||||
* @return the associated auth object, or null if not available
|
||||
*/
|
||||
public PlayerAuth getAuth(String user) {
|
||||
return cache.get(user.toLowerCase());
|
||||
return cache.get(user.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package fr.xephi.authme.data.captcha;
|
||||
import fr.xephi.authme.util.RandomStringUtils;
|
||||
import fr.xephi.authme.util.expiring.ExpiringMap;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,7 @@ public class CaptchaCodeStorage {
|
||||
* @return the code the player is required to enter
|
||||
*/
|
||||
public String getCodeOrGenerateNew(String name) {
|
||||
String code = captchaCodes.get(name.toLowerCase());
|
||||
String code = captchaCodes.get(name.toLowerCase(Locale.ROOT));
|
||||
return code == null ? generateCode(name) : code;
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ public class CaptchaCodeStorage {
|
||||
*/
|
||||
private String generateCode(String name) {
|
||||
String code = RandomStringUtils.generate(captchaLength);
|
||||
captchaCodes.put(name.toLowerCase(), code);
|
||||
captchaCodes.put(name.toLowerCase(Locale.ROOT), code);
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ public class CaptchaCodeStorage {
|
||||
* @return true if the code matches, false otherwise
|
||||
*/
|
||||
public boolean checkCode(String name, String code) {
|
||||
String nameLowerCase = name.toLowerCase();
|
||||
String nameLowerCase = name.toLowerCase(Locale.ROOT);
|
||||
String savedCode = captchaCodes.get(nameLowerCase);
|
||||
if (savedCode != null && savedCode.equalsIgnoreCase(code)) {
|
||||
captchaCodes.remove(nameLowerCase);
|
||||
|
||||
@@ -8,6 +8,7 @@ import fr.xephi.authme.util.expiring.TimedCounter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -36,14 +37,14 @@ public class LoginCaptchaManager implements CaptchaManager, SettingsDependent, H
|
||||
*/
|
||||
public void increaseLoginFailureCount(String name) {
|
||||
if (isEnabled) {
|
||||
String playerLower = name.toLowerCase();
|
||||
String playerLower = name.toLowerCase(Locale.ROOT);
|
||||
playerCounts.increment(playerLower);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCaptchaRequired(String playerName) {
|
||||
return isEnabled && playerCounts.get(playerName.toLowerCase()) >= threshold;
|
||||
return isEnabled && playerCounts.get(playerName.toLowerCase(Locale.ROOT)) >= threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,7 +54,7 @@ public class LoginCaptchaManager implements CaptchaManager, SettingsDependent, H
|
||||
|
||||
@Override
|
||||
public boolean checkCode(Player player, String code) {
|
||||
String nameLower = player.getName().toLowerCase();
|
||||
String nameLower = player.getName().toLowerCase(Locale.ROOT);
|
||||
boolean isCodeCorrect = captchaCodeStorage.checkCode(nameLower, code);
|
||||
if (isCodeCorrect) {
|
||||
playerCounts.remove(nameLower);
|
||||
@@ -68,7 +69,7 @@ public class LoginCaptchaManager implements CaptchaManager, SettingsDependent, H
|
||||
*/
|
||||
public void resetLoginFailureCount(String name) {
|
||||
if (isEnabled) {
|
||||
playerCounts.remove(name.toLowerCase());
|
||||
playerCounts.remove(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import fr.xephi.authme.util.expiring.ExpiringSet;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -31,7 +32,7 @@ public class RegistrationCaptchaManager implements CaptchaManager, SettingsDepen
|
||||
|
||||
@Override
|
||||
public boolean isCaptchaRequired(String name) {
|
||||
return isEnabled && !verifiedNamesForRegistration.contains(name.toLowerCase());
|
||||
return isEnabled && !verifiedNamesForRegistration.contains(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,7 +42,7 @@ public class RegistrationCaptchaManager implements CaptchaManager, SettingsDepen
|
||||
|
||||
@Override
|
||||
public boolean checkCode(Player player, String code) {
|
||||
String nameLower = player.getName().toLowerCase();
|
||||
String nameLower = player.getName().toLowerCase(Locale.ROOT);
|
||||
boolean isCodeCorrect = captchaCodeStorage.checkCode(nameLower, code);
|
||||
if (isCodeCorrect) {
|
||||
verifiedNamesForRegistration.add(nameLower);
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -55,7 +56,7 @@ public class LimboService {
|
||||
* @param isRegistered whether or not the player is registered
|
||||
*/
|
||||
public void createLimboPlayer(Player player, boolean isRegistered) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
final String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
|
||||
LimboPlayer limboFromDisk = persistence.getLimboPlayer(player);
|
||||
if (limboFromDisk != null) {
|
||||
@@ -89,7 +90,7 @@ public class LimboService {
|
||||
* @return the associated limbo player, or null if none available
|
||||
*/
|
||||
public LimboPlayer getLimboPlayer(String name) {
|
||||
return entries.get(name.toLowerCase());
|
||||
return entries.get(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +100,7 @@ public class LimboService {
|
||||
* @return true if present, false otherwise
|
||||
*/
|
||||
public boolean hasLimboPlayer(String name) {
|
||||
return entries.containsKey(name.toLowerCase());
|
||||
return entries.containsKey(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +112,7 @@ public class LimboService {
|
||||
* @param player the player whose data should be restored
|
||||
*/
|
||||
public void restoreData(Player player) {
|
||||
String lowerName = player.getName().toLowerCase();
|
||||
String lowerName = player.getName().toLowerCase(Locale.ROOT);
|
||||
LimboPlayer limbo = entries.remove(lowerName);
|
||||
|
||||
if (limbo == null) {
|
||||
@@ -178,7 +179,7 @@ public class LimboService {
|
||||
* @return Optional with the limbo player
|
||||
*/
|
||||
private Optional<LimboPlayer> getLimboOrLogError(Player player, String context) {
|
||||
LimboPlayer limbo = entries.get(player.getName().toLowerCase());
|
||||
LimboPlayer limbo = entries.get(player.getName().toLowerCase(Locale.ROOT));
|
||||
if (limbo == null) {
|
||||
logger.debug("No LimboPlayer found for `{0}`. Action: {1}", player.getName(), context);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import fr.xephi.authme.util.Utils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -86,7 +87,7 @@ public class CacheDataSource implements DataSource {
|
||||
|
||||
@Override
|
||||
public HashedPassword getPassword(String user) {
|
||||
user = user.toLowerCase();
|
||||
user = user.toLowerCase(Locale.ROOT);
|
||||
Optional<PlayerAuth> pAuthOpt = cachedAuths.getIfPresent(user);
|
||||
if (pAuthOpt != null && pAuthOpt.isPresent()) {
|
||||
return pAuthOpt.get().getPassword();
|
||||
@@ -96,7 +97,7 @@ public class CacheDataSource implements DataSource {
|
||||
|
||||
@Override
|
||||
public PlayerAuth getAuth(String user) {
|
||||
user = user.toLowerCase();
|
||||
user = user.toLowerCase(Locale.ROOT);
|
||||
return cachedAuths.getUnchecked(user).orElse(null);
|
||||
}
|
||||
|
||||
@@ -120,7 +121,7 @@ public class CacheDataSource implements DataSource {
|
||||
|
||||
@Override
|
||||
public boolean updatePassword(String user, HashedPassword password) {
|
||||
user = user.toLowerCase();
|
||||
user = user.toLowerCase(Locale.ROOT);
|
||||
boolean result = source.updatePassword(user, password);
|
||||
if (result) {
|
||||
cachedAuths.refresh(user);
|
||||
@@ -153,7 +154,7 @@ public class CacheDataSource implements DataSource {
|
||||
|
||||
@Override
|
||||
public boolean removeAuth(String name) {
|
||||
name = name.toLowerCase();
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
boolean result = source.removeAuth(name);
|
||||
if (result) {
|
||||
cachedAuths.invalidate(name);
|
||||
@@ -210,12 +211,12 @@ public class CacheDataSource implements DataSource {
|
||||
|
||||
@Override
|
||||
public void setLogged(final String user) {
|
||||
source.setLogged(user.toLowerCase());
|
||||
source.setLogged(user.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUnlogged(final String user) {
|
||||
source.setUnlogged(user.toLowerCase());
|
||||
source.setUnlogged(user.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -309,7 +310,7 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
String sql = "SELECT * FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
PlayerAuth auth;
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, user.toLowerCase());
|
||||
pst.setString(1, user.toLowerCase(Locale.ROOT));
|
||||
try (ResultSet rs = pst.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
int id = rs.getInt(col.ID);
|
||||
@@ -377,11 +378,11 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
|
||||
@Override
|
||||
public boolean removeAuth(String user) {
|
||||
user = user.toLowerCase();
|
||||
user = user.toLowerCase(Locale.ROOT);
|
||||
String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
sqlExtension.removeAuth(user, con);
|
||||
pst.setString(1, user.toLowerCase());
|
||||
pst.setString(1, user.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
@@ -402,7 +403,7 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
for (String name : toPurge) {
|
||||
pst.setString(1, name.toLowerCase());
|
||||
pst.setString(1, name.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
@@ -470,7 +471,7 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
String sql = "UPDATE " + tableName + " SET " + col.TOTP_KEY + " = ? WHERE " + col.NAME + " = ?";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, totpKey);
|
||||
pst.setString(2, user.toLowerCase());
|
||||
pst.setString(2, user.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import static fr.xephi.authme.datasource.SqlDataSourceUtils.getNullableLong;
|
||||
@@ -257,7 +258,7 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
|
||||
}
|
||||
|
||||
private boolean isColumnMissing(DatabaseMetaData metaData, String columnName) throws SQLException {
|
||||
try (ResultSet rs = metaData.getColumns(null, null, tableName, columnName.toLowerCase())) {
|
||||
try (ResultSet rs = metaData.getColumns(null, null, tableName, columnName.toLowerCase(Locale.ROOT))) {
|
||||
return !rs.next();
|
||||
}
|
||||
}
|
||||
@@ -267,7 +268,7 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
|
||||
String sql = "SELECT * FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
PlayerAuth auth;
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, user.toLowerCase());
|
||||
pst.setString(1, user.toLowerCase(Locale.ROOT));
|
||||
try (ResultSet rs = pst.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
int id = rs.getInt(col.ID);
|
||||
@@ -335,11 +336,11 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
|
||||
|
||||
@Override
|
||||
public boolean removeAuth(String user) {
|
||||
user = user.toLowerCase();
|
||||
user = user.toLowerCase(Locale.ROOT);
|
||||
String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
sqlExtension.removeAuth(user, con);
|
||||
pst.setString(1, user.toLowerCase());
|
||||
pst.setString(1, user.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
@@ -360,7 +361,7 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
|
||||
String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
for (String name : toPurge) {
|
||||
pst.setString(1, name.toLowerCase());
|
||||
pst.setString(1, name.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
@@ -428,7 +429,7 @@ public class PostgreSqlDataSource extends AbstractSqlDataSource {
|
||||
String sql = "UPDATE " + tableName + " SET " + col.TOTP_KEY + " = ? WHERE " + col.NAME + " = ?";
|
||||
try (Connection con = getConnection(); PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, totpKey);
|
||||
pst.setString(2, user.toLowerCase());
|
||||
pst.setString(2, user.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import static fr.xephi.authme.datasource.SqlDataSourceUtils.getNullableLong;
|
||||
@@ -268,7 +269,7 @@ public class SQLite extends AbstractSqlDataSource {
|
||||
String delete = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
try (PreparedStatement deletePst = con.prepareStatement(delete)) {
|
||||
for (String name : toPurge) {
|
||||
deletePst.setString(1, name.toLowerCase());
|
||||
deletePst.setString(1, name.toLowerCase(Locale.ROOT));
|
||||
deletePst.executeUpdate();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
@@ -280,7 +281,7 @@ public class SQLite extends AbstractSqlDataSource {
|
||||
public boolean removeAuth(String user) {
|
||||
String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
try (PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, user.toLowerCase());
|
||||
pst.setString(1, user.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
@@ -355,7 +356,7 @@ public class SQLite extends AbstractSqlDataSource {
|
||||
String sql = "UPDATE " + tableName + " SET " + col.TOTP_KEY + " = ? WHERE " + col.NAME + " = ?";
|
||||
try (PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
pst.setString(1, totpKey);
|
||||
pst.setString(2, user.toLowerCase());
|
||||
pst.setString(2, user.toLowerCase(Locale.ROOT));
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static ch.jalu.datasourcecolumns.sqlimplementation.SqlColumnsHandlerConfig.forConnectionPool;
|
||||
import static ch.jalu.datasourcecolumns.sqlimplementation.SqlColumnsHandlerConfig.forSingleConnection;
|
||||
@@ -78,7 +79,7 @@ public final class AuthMeColumnsHandler {
|
||||
*/
|
||||
public <T> boolean update(String name, DataSourceColumn<T> column, T value) {
|
||||
try {
|
||||
return internalHandler.update(name.toLowerCase(), column, value);
|
||||
return internalHandler.update(name.toLowerCase(Locale.ROOT), column, value);
|
||||
} catch (SQLException e) {
|
||||
logSqlException(e);
|
||||
return false;
|
||||
@@ -110,7 +111,7 @@ public final class AuthMeColumnsHandler {
|
||||
*/
|
||||
public boolean update(String name, UpdateValues<ColumnContext> updateValues) {
|
||||
try {
|
||||
return internalHandler.update(name.toLowerCase(), updateValues);
|
||||
return internalHandler.update(name.toLowerCase(Locale.ROOT), updateValues);
|
||||
} catch (SQLException e) {
|
||||
logSqlException(e);
|
||||
return false;
|
||||
@@ -145,7 +146,7 @@ public final class AuthMeColumnsHandler {
|
||||
* @throws SQLException .
|
||||
*/
|
||||
public <T> DataSourceValue<T> retrieve(String name, DataSourceColumn<T> column) throws SQLException {
|
||||
return internalHandler.retrieve(name.toLowerCase(), column);
|
||||
return internalHandler.retrieve(name.toLowerCase(Locale.ROOT), column);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +158,7 @@ public final class AuthMeColumnsHandler {
|
||||
* @throws SQLException .
|
||||
*/
|
||||
public DataSourceValues retrieve(String name, DataSourceColumn<?>... columns) throws SQLException {
|
||||
return internalHandler.retrieve(name.toLowerCase(), columns);
|
||||
return internalHandler.retrieve(name.toLowerCase(Locale.ROOT), columns);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Converter for CrazyLogin to AuthMe.
|
||||
@@ -70,7 +71,7 @@ public class CrazyLoginConverter implements Converter {
|
||||
String password = args[1];
|
||||
if (password != null) {
|
||||
PlayerAuth auth = PlayerAuth.builder()
|
||||
.name(playerName.toLowerCase())
|
||||
.name(playerName.toLowerCase(Locale.ROOT))
|
||||
.realName(playerName)
|
||||
.password(password, null)
|
||||
.build();
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.util.FileUtils.makePath;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class RoyalAuthConverter implements Converter {
|
||||
public void execute(CommandSender sender) {
|
||||
for (OfflinePlayer player : plugin.getServer().getOfflinePlayers()) {
|
||||
try {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
File file = new File(makePath(".", "plugins", "RoyalAuth", "userdata", name + ".yml"));
|
||||
|
||||
if (dataSource.isAuthAvailable(name) || !file.exists()) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.bukkit.command.CommandSender;
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -48,12 +49,12 @@ public class VAuthConverter implements Converter {
|
||||
continue;
|
||||
}
|
||||
auth = PlayerAuth.builder()
|
||||
.name(pname.toLowerCase())
|
||||
.name(pname.toLowerCase(Locale.ROOT))
|
||||
.realName(pname)
|
||||
.password(password, null).build();
|
||||
} else {
|
||||
auth = PlayerAuth.builder()
|
||||
.name(name.toLowerCase())
|
||||
.name(name.toLowerCase(Locale.ROOT))
|
||||
.realName(name)
|
||||
.password(password, null).build();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.util.FileUtils.makePath;
|
||||
|
||||
@@ -66,7 +67,7 @@ public class XAuthConverter implements Converter {
|
||||
String psw = getPassword(id);
|
||||
if (psw != null && !psw.isEmpty() && pl != null) {
|
||||
PlayerAuth auth = PlayerAuth.builder()
|
||||
.name(pl.toLowerCase())
|
||||
.name(pl.toLowerCase(Locale.ROOT))
|
||||
.realName(pl)
|
||||
.password(psw, null).build();
|
||||
database.saveAuth(auth);
|
||||
@@ -89,7 +90,7 @@ public class XAuthConverter implements Converter {
|
||||
if (!rs.next()) {
|
||||
return null;
|
||||
}
|
||||
realPass = rs.getString("playername").toLowerCase();
|
||||
realPass = rs.getString("playername").toLowerCase(Locale.ROOT);
|
||||
} catch (SQLException e) {
|
||||
xAuthLog.severe("Failed to retrieve name for account: " + id, e);
|
||||
return null;
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Saves all players' data when the plugin shuts down.
|
||||
@@ -48,7 +49,7 @@ public class OnShutdownPlayerSaver {
|
||||
}
|
||||
|
||||
private void savePlayer(Player player) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
if (PlayerUtils.isNpc(player) || validationService.isUnrestricted(name)) {
|
||||
return;
|
||||
}
|
||||
@@ -64,7 +65,7 @@ public class OnShutdownPlayerSaver {
|
||||
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
|
||||
Location loc = spawnLoader.getPlayerLocationOrSpawn(player);
|
||||
PlayerAuth auth = PlayerAuth.builder()
|
||||
.name(player.getName().toLowerCase())
|
||||
.name(player.getName().toLowerCase(Locale.ROOT))
|
||||
.realName(player.getName())
|
||||
.location(loc).build();
|
||||
dataSource.updateQuitLoc(auth);
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
@@ -160,7 +161,7 @@ public class OnJoinVerifier implements Reloadable {
|
||||
String realName = auth.getRealName(); // might be null or "Player"
|
||||
|
||||
if (StringUtils.isEmpty(realName) || "Player".equals(realName)) {
|
||||
dataSource.updateRealName(connectingName.toLowerCase(), connectingName);
|
||||
dataSource.updateRealName(connectingName.toLowerCase(Locale.ROOT), connectingName);
|
||||
} else if (!realName.equals(connectingName)) {
|
||||
throw new FailedVerificationException(MessageKey.INVALID_NAME_CASE, realName, connectingName);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOWED_MOVEMENT_RADIUS;
|
||||
@@ -214,7 +215,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
String joinMsg = event.getJoinMessage();
|
||||
|
||||
// Remove the join message while the player isn't logging in
|
||||
@@ -292,7 +293,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
String cmd = event.getMessage().split(" ")[0].toLowerCase();
|
||||
String cmd = event.getMessage().split(" ")[0].toLowerCase(Locale.ROOT);
|
||||
if (settings.getProperty(HooksSettings.USE_ESSENTIALS_MOTD) && "/motd".equals(cmd)) {
|
||||
return;
|
||||
}
|
||||
@@ -482,7 +483,7 @@ public class PlayerListener implements Listener {
|
||||
return false;
|
||||
}
|
||||
Set<String> whitelist = settings.getProperty(RestrictionSettings.UNRESTRICTED_INVENTORIES);
|
||||
return whitelist.contains(ChatColor.stripColor(inventory.getTitle()).toLowerCase());
|
||||
return whitelist.contains(ChatColor.stripColor(inventory.getTitle()).toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
|
||||
@@ -6,6 +6,7 @@ import fr.xephi.authme.util.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Service class for the log filters.
|
||||
@@ -35,7 +36,7 @@ final class LogFilterHelper {
|
||||
if (message == null) {
|
||||
return false;
|
||||
}
|
||||
String lowerMessage = message.toLowerCase();
|
||||
String lowerMessage = message.toLowerCase(Locale.ROOT);
|
||||
return lowerMessage.contains(ISSUED_COMMAND_TEXT) && StringUtils.containsAny(lowerMessage, COMMANDS_TO_SKIP);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
|
||||
public class AsyncChangePassword implements AsynchronousProcess {
|
||||
|
||||
@@ -42,7 +43,7 @@ public class AsyncChangePassword implements AsynchronousProcess {
|
||||
* @param newPassword the new password chosen by the player
|
||||
*/
|
||||
public void changePassword(Player player, String oldPassword, String newPassword) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
PlayerAuth auth = playerCache.getAuth(name);
|
||||
if (passwordSecurity.comparePassword(oldPassword, auth.getPassword(), player.getName())) {
|
||||
HashedPassword hashedPassword = passwordSecurity.computeHash(newPassword, name);
|
||||
@@ -71,7 +72,7 @@ public class AsyncChangePassword implements AsynchronousProcess {
|
||||
* @param newPassword the new password chosen for the player
|
||||
*/
|
||||
public void changePasswordAsAdmin(CommandSender sender, String playerName, String newPassword) {
|
||||
String lowerCaseName = playerName.toLowerCase();
|
||||
String lowerCaseName = playerName.toLowerCase(Locale.ROOT);
|
||||
if (!(playerCache.isAuthenticated(lowerCaseName) || dataSource.isAuthAvailable(lowerCaseName))) {
|
||||
if (sender == null) {
|
||||
logger.warning("Tried to change password for user " + lowerCaseName + " but it doesn't exist!");
|
||||
|
||||
@@ -15,6 +15,7 @@ import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Async task to add an email to an account.
|
||||
@@ -48,7 +49,7 @@ public class AsyncAddEmail implements AsynchronousProcess {
|
||||
* @param email the email to add
|
||||
*/
|
||||
public void addEmail(Player player, String email) {
|
||||
String playerName = player.getName().toLowerCase();
|
||||
String playerName = player.getName().toLowerCase(Locale.ROOT);
|
||||
|
||||
if (playerCache.isAuthenticated(playerName)) {
|
||||
PlayerAuth auth = playerCache.getAuth(playerName);
|
||||
|
||||
@@ -14,6 +14,7 @@ import fr.xephi.authme.service.ValidationService;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Async task for changing the email.
|
||||
@@ -48,7 +49,7 @@ public class AsyncChangeEmail implements AsynchronousProcess {
|
||||
* @param newEmail provided new email
|
||||
*/
|
||||
public void changeEmail(Player player, String oldEmail, String newEmail) {
|
||||
String playerName = player.getName().toLowerCase();
|
||||
String playerName = player.getName().toLowerCase(Locale.ROOT);
|
||||
if (playerCache.isAuthenticated(playerName)) {
|
||||
PlayerAuth auth = playerCache.getAuth(playerName);
|
||||
String currentEmail = auth.getEmail();
|
||||
|
||||
@@ -32,6 +32,8 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.service.BukkitService.TICKS_PER_SECOND;
|
||||
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
|
||||
|
||||
@@ -90,7 +92,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
* @param player the player to process
|
||||
*/
|
||||
public void processJoin(Player player) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
String ip = PlayerUtils.getPlayerIp(player);
|
||||
|
||||
if (!validationService.fulfillsNameRestrictions(player)) {
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.bukkit.entity.Player;
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Asynchronous task for a player login.
|
||||
@@ -153,7 +154,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
* (e.g. because he is already logged in)
|
||||
*/
|
||||
private PlayerAuth getPlayerAuth(Player player, boolean quiet) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
if (playerCache.isAuthenticated(name)) {
|
||||
if (!quiet) {
|
||||
service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
|
||||
@@ -206,7 +207,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
* false otherwise
|
||||
*/
|
||||
private boolean checkPlayerInfo(Player player, PlayerAuth auth, String password) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
|
||||
// If captcha is required send a message to the player and deny to log in
|
||||
if (loginCaptchaManager.isCaptchaRequired(name)) {
|
||||
@@ -380,7 +381,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
for (Player onlinePlayer : bukkitService.getOnlinePlayers()) {
|
||||
if (ip.equalsIgnoreCase(PlayerUtils.getPlayerIp(onlinePlayer))
|
||||
&& !onlinePlayer.getName().equals(name)
|
||||
&& dataSource.isLogged(onlinePlayer.getName().toLowerCase())) {
|
||||
&& dataSource.isLogged(onlinePlayer.getName().toLowerCase(Locale.ROOT))) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
|
||||
|
||||
@@ -76,7 +77,7 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
|
||||
* @param authsWithSameIp registered names with the same IP address as the player's
|
||||
*/
|
||||
public void processPlayerLogin(Player player, boolean isFirstLogin, List<String> authsWithSameIp) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
final String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
final LimboPlayer limbo = limboService.getLimboPlayer(name);
|
||||
|
||||
// Limbo contains the State of the Player before /login
|
||||
|
||||
@@ -15,6 +15,7 @@ import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Async task when a player wants to log out.
|
||||
@@ -51,7 +52,7 @@ public class AsynchronousLogout implements AsynchronousProcess {
|
||||
* @param player the player wanting to log out
|
||||
*/
|
||||
public void logout(Player player) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
if (!playerCache.isAuthenticated(name)) {
|
||||
service.send(player, MessageKey.NOT_LOGGED_IN);
|
||||
return;
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Async process called when a player quits the server.
|
||||
@@ -63,7 +64,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
if (player == null || validationService.isUnrestricted(player.getName())) {
|
||||
return;
|
||||
}
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
boolean wasLoggedIn = playerCache.isAuthenticated(name);
|
||||
|
||||
if (wasLoggedIn) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.permission.PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS;
|
||||
|
||||
@@ -67,7 +68,7 @@ public class AsyncRegister implements AsynchronousProcess {
|
||||
* @return true if the checks are successful and the event hasn't marked the action as denied, false otherwise.
|
||||
*/
|
||||
private boolean preRegisterCheck(RegistrationMethod<?> variant, Player player) {
|
||||
String name = player.getName().toLowerCase();
|
||||
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||
if (playerCache.isAuthenticated(name)) {
|
||||
service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
|
||||
return false;
|
||||
|
||||
+3
-1
@@ -5,6 +5,8 @@ import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.util.PlayerUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Helper for constructing PlayerAuth objects.
|
||||
*/
|
||||
@@ -23,7 +25,7 @@ final class PlayerAuthBuilderHelper {
|
||||
*/
|
||||
static PlayerAuth createPlayerAuth(Player player, HashedPassword hashedPassword, String email) {
|
||||
return PlayerAuth.builder()
|
||||
.name(player.getName().toLowerCase())
|
||||
.name(player.getName().toLowerCase(Locale.ROOT))
|
||||
.realName(player.getName())
|
||||
.password(hashedPassword)
|
||||
.email(email)
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginManager;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Manager class for password-related operations.
|
||||
@@ -54,7 +55,7 @@ public class PasswordSecurity implements Reloadable {
|
||||
* @return The password hash
|
||||
*/
|
||||
public HashedPassword computeHash(String password, String playerName) {
|
||||
String playerLowerCase = playerName.toLowerCase();
|
||||
String playerLowerCase = playerName.toLowerCase(Locale.ROOT);
|
||||
return encryptionMethod.computeHash(password, playerLowerCase);
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ public class PasswordSecurity implements Reloadable {
|
||||
* @return True if the password matches, false otherwise
|
||||
*/
|
||||
public boolean comparePassword(String password, HashedPassword hashedPassword, String playerName) {
|
||||
String playerLowerCase = playerName.toLowerCase();
|
||||
String playerLowerCase = playerName.toLowerCase(Locale.ROOT);
|
||||
return methodMatches(encryptionMethod, password, hashedPassword, playerLowerCase)
|
||||
|| compareWithLegacyHashes(password, hashedPassword, playerLowerCase);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import fr.xephi.authme.security.crypts.description.SaltType;
|
||||
import fr.xephi.authme.security.crypts.description.Usage;
|
||||
import fr.xephi.authme.util.RandomStringUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.security.HashUtils.isEqual;
|
||||
|
||||
/**
|
||||
@@ -29,7 +31,7 @@ public class Smf implements EncryptionMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
return HashUtils.sha1(name.toLowerCase() + password);
|
||||
return HashUtils.sha1(name.toLowerCase(Locale.ROOT) + password);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,8 @@ package fr.xephi.authme.security.crypts;
|
||||
import fr.xephi.authme.security.crypts.description.Recommendation;
|
||||
import fr.xephi.authme.security.crypts.description.Usage;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.security.HashUtils.isEqual;
|
||||
|
||||
@Recommendation(Usage.RECOMMENDED)
|
||||
@@ -19,7 +21,7 @@ public class XAuth extends HexSaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
String hash = getWhirlpool(salt + password).toLowerCase();
|
||||
String hash = getWhirlpool(salt + password).toLowerCase(Locale.ROOT);
|
||||
int saltPos = password.length() >= hash.length() ? hash.length() - 1 : password.length();
|
||||
return hash.substring(0, saltPos) + salt + hash.substring(saltPos);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import fr.xephi.authme.util.expiring.ExpiringMap;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -32,7 +33,7 @@ public class GenerateTotpService implements HasCleanup {
|
||||
*/
|
||||
public TotpGenerationResult generateTotpKey(Player player) {
|
||||
TotpGenerationResult credentials = totpAuthenticator.generateTotpKey(player);
|
||||
totpKeys.put(player.getName().toLowerCase(), credentials);
|
||||
totpKeys.put(player.getName().toLowerCase(Locale.ROOT), credentials);
|
||||
return credentials;
|
||||
}
|
||||
|
||||
@@ -43,11 +44,11 @@ public class GenerateTotpService implements HasCleanup {
|
||||
* @return TOTP generation result
|
||||
*/
|
||||
public TotpGenerationResult getGeneratedTotpKey(Player player) {
|
||||
return totpKeys.get(player.getName().toLowerCase());
|
||||
return totpKeys.get(player.getName().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
public void removeGenerateTotpKey(Player player) {
|
||||
totpKeys.remove(player.getName().toLowerCase());
|
||||
totpKeys.remove(player.getName().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +59,7 @@ public class GenerateTotpService implements HasCleanup {
|
||||
* @return true if the input code is correct, false if the code is invalid or no unexpired totp key is available
|
||||
*/
|
||||
public boolean isTotpCodeCorrectForGeneratedTotpKey(Player player, String totpCode) {
|
||||
TotpGenerationResult totpDetails = totpKeys.get(player.getName().toLowerCase());
|
||||
TotpGenerationResult totpDetails = totpKeys.get(player.getName().toLowerCase(Locale.ROOT));
|
||||
return totpDetails != null && totpAuthenticator.checkCode(player.getName(), totpDetails.getTotpKey(), totpCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.util.Utils.MILLIS_PER_MINUTE;
|
||||
|
||||
/**
|
||||
@@ -54,7 +56,7 @@ public class TotpAuthenticator implements HasCleanup {
|
||||
* @return true if code is valid, false otherwise
|
||||
*/
|
||||
public boolean checkCode(String playerName, String totpKey, String inputCode) {
|
||||
String nameLower = playerName.toLowerCase();
|
||||
String nameLower = playerName.toLowerCase(Locale.ROOT);
|
||||
Integer totpCode = Ints.tryParse(inputCode);
|
||||
if (totpCode != null && !usedCodes.contains(nameLower, totpCode)
|
||||
&& authenticator.authorize(totpKey, totpCode)) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import fr.xephi.authme.util.AtomicIntervalCounter;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
|
||||
@@ -176,7 +177,7 @@ public class AntiBotService implements SettingsDependent {
|
||||
* @return true if the given name has been kicked because of Antibot
|
||||
*/
|
||||
public boolean wasPlayerKicked(String name) {
|
||||
return antibotKicked.contains(name.toLowerCase());
|
||||
return antibotKicked.contains(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +187,7 @@ public class AntiBotService implements SettingsDependent {
|
||||
* @param name the name to add
|
||||
*/
|
||||
public void addPlayerKick(String name) {
|
||||
antibotKicked.addIfAbsent(name.toLowerCase());
|
||||
antibotKicked.addIfAbsent(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
public enum AntiBotStatus {
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.util.Utils.logAndSendMessage;
|
||||
import static fr.xephi.authme.util.Utils.logAndSendWarning;
|
||||
@@ -151,7 +152,7 @@ public class BackupService {
|
||||
* @return True if the path is correct, false if it is incorrect or the OS is not Windows
|
||||
*/
|
||||
private boolean useWindowsCommand(String windowsPath) {
|
||||
String isWin = System.getProperty("os.name").toLowerCase();
|
||||
String isWin = System.getProperty("os.name").toLowerCase(Locale.ROOT);
|
||||
if (isWin.contains("win")) {
|
||||
if (new File(windowsPath + "\\bin\\mysqldump.exe").exists()) {
|
||||
return true;
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static fr.xephi.authme.settings.properties.EmailSettings.RECOVERY_PASSWORD_LENGTH;
|
||||
@@ -76,7 +77,7 @@ public class PasswordRecoveryService implements Reloadable, HasCleanup {
|
||||
boolean couldSendMail = emailService.sendRecoveryCode(player.getName(), email, recoveryCode);
|
||||
if (couldSendMail) {
|
||||
commonService.send(player, MessageKey.RECOVERY_CODE_SENT);
|
||||
emailCooldown.add(player.getName().toLowerCase());
|
||||
emailCooldown.add(player.getName().toLowerCase(Locale.ROOT));
|
||||
} else {
|
||||
commonService.send(player, MessageKey.EMAIL_SEND_FAILURE);
|
||||
}
|
||||
@@ -104,7 +105,7 @@ public class PasswordRecoveryService implements Reloadable, HasCleanup {
|
||||
boolean couldSendMail = emailService.sendPasswordMail(name, email, thePass);
|
||||
if (couldSendMail) {
|
||||
commonService.send(player, MessageKey.RECOVERY_EMAIL_SENT_MESSAGE);
|
||||
emailCooldown.add(player.getName().toLowerCase());
|
||||
emailCooldown.add(player.getName().toLowerCase(Locale.ROOT));
|
||||
} else {
|
||||
commonService.send(player, MessageKey.EMAIL_SEND_FAILURE);
|
||||
}
|
||||
@@ -141,7 +142,7 @@ public class PasswordRecoveryService implements Reloadable, HasCleanup {
|
||||
* @return True if the player is not on cooldown.
|
||||
*/
|
||||
private boolean checkEmailCooldown(Player player) {
|
||||
Duration waitDuration = emailCooldown.getExpiration(player.getName().toLowerCase());
|
||||
Duration waitDuration = emailCooldown.getExpiration(player.getName().toLowerCase(Locale.ROOT));
|
||||
if (waitDuration.getDuration() > 0) {
|
||||
String durationText = messages.formatDuration(waitDuration);
|
||||
messages.send(player, MessageKey.EMAIL_COOLDOWN_ERROR, durationText);
|
||||
|
||||
@@ -25,6 +25,7 @@ import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -69,7 +70,7 @@ public class ValidationService implements Reloadable {
|
||||
* @return the validation result
|
||||
*/
|
||||
public ValidationResult validatePassword(String password, String username) {
|
||||
String passLow = password.toLowerCase();
|
||||
String passLow = password.toLowerCase(Locale.ROOT);
|
||||
if (!passwordRegex.matcher(passLow).matches()) {
|
||||
return new ValidationResult(MessageKey.PASSWORD_CHARACTERS_ERROR, passwordRegex.pattern());
|
||||
} else if (passLow.equalsIgnoreCase(username)) {
|
||||
@@ -139,7 +140,7 @@ public class ValidationService implements Reloadable {
|
||||
* @return true if unrestricted, false otherwise
|
||||
*/
|
||||
public boolean isUnrestricted(String name) {
|
||||
return settings.getProperty(RestrictionSettings.UNRESTRICTED_NAMES).contains(name.toLowerCase());
|
||||
return settings.getProperty(RestrictionSettings.UNRESTRICTED_NAMES).contains(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,7 +150,7 @@ public class ValidationService implements Reloadable {
|
||||
* @return true if the player may join, false if the player does not satisfy the name restrictions
|
||||
*/
|
||||
public boolean fulfillsNameRestrictions(Player player) {
|
||||
Collection<String> restrictions = restrictedNames.get(player.getName().toLowerCase());
|
||||
Collection<String> restrictions = restrictedNames.get(player.getName().toLowerCase(Locale.ROOT));
|
||||
if (Utils.isCollectionEmpty(restrictions)) {
|
||||
return true;
|
||||
}
|
||||
@@ -212,7 +213,7 @@ public class ValidationService implements Reloadable {
|
||||
for (String restriction : configuredRestrictions) {
|
||||
if (isInsideString(';', restriction)) {
|
||||
String[] data = restriction.split(";");
|
||||
restrictions.put(data[0].toLowerCase(), data[1]);
|
||||
restrictions.put(data[0].toLowerCase(Locale.ROOT), data[1]);
|
||||
} else {
|
||||
logger.warning("Restricted user rule must have a ';' separating name from restriction,"
|
||||
+ " but found: '" + restriction + "'");
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.Messenger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BungeeSender implements SettingsDependent {
|
||||
|
||||
@@ -103,9 +104,9 @@ public class BungeeSender implements SettingsDependent {
|
||||
return;
|
||||
}
|
||||
if (type.isBroadcast()) {
|
||||
sendForwardedBungeecordMessage(player, "AuthMe.v2.Broadcast", type.getId(), player.getName().toLowerCase());
|
||||
sendForwardedBungeecordMessage(player, "AuthMe.v2.Broadcast", type.getId(), player.getName().toLowerCase(Locale.ROOT));
|
||||
} else {
|
||||
sendBungeecordMessage(player, "AuthMe.v2", type.getId(), player.getName().toLowerCase());
|
||||
sendBungeecordMessage(player, "AuthMe.v2", type.getId(), player.getName().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.bukkit.entity.Player;
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Manager for spawn points. It loads spawn definitions from AuthMe and third-party plugins
|
||||
@@ -177,7 +178,7 @@ public class SpawnLoader implements Reloadable {
|
||||
World world = player.getWorld();
|
||||
Location spawnLoc = null;
|
||||
for (String priority : spawnPriority) {
|
||||
switch (priority.toLowerCase().trim()) {
|
||||
switch (priority.toLowerCase(Locale.ROOT).trim()) {
|
||||
case "default":
|
||||
if (world.getSpawnLocation() != null) {
|
||||
if (!isValidSpawnPoint(world.getSpawnLocation())) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.bukkit.Server;
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
import static fr.xephi.authme.util.FileUtils.makePath;
|
||||
|
||||
@@ -80,7 +81,7 @@ public class PurgeExecutor {
|
||||
}
|
||||
|
||||
for (String file : dataFolder.list()) {
|
||||
if (cleared.contains(file.toLowerCase())) {
|
||||
if (cleared.contains(file.toLowerCase(Locale.ROOT))) {
|
||||
File playerFile = new File(dataFolder, file);
|
||||
if (playerFile.exists() && playerFile.delete()) {
|
||||
i++;
|
||||
@@ -137,7 +138,7 @@ public class PurgeExecutor {
|
||||
if (name.equals(file)) {
|
||||
continue;
|
||||
}
|
||||
if (cleared.contains(name.toLowerCase())) {
|
||||
if (cleared.contains(name.toLowerCase(Locale.ROOT))) {
|
||||
File dataFile = new File(dataFolder, file);
|
||||
if (dataFile.exists() && dataFile.delete()) {
|
||||
i++;
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -74,7 +75,7 @@ class PurgeTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
OfflinePlayer offlinePlayer = offlinePlayers[nextPosition];
|
||||
if (offlinePlayer.getName() != null && toPurge.remove(offlinePlayer.getName().toLowerCase())) {
|
||||
if (offlinePlayer.getName() != null && toPurge.remove(offlinePlayer.getName().toLowerCase(Locale.ROOT))) {
|
||||
if (!permissionsManager.loadUserData(offlinePlayer)) {
|
||||
logger.warning("Unable to check if the user " + offlinePlayer.getName() + " can be purged!");
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user