mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
Cleanup after UUID Ignore List PR (#3227)
Most of these are edge case fixes, but still fixes nonetheless!
This commit is contained in:
parent
fd136384a1
commit
81d3900ef6
@ -43,9 +43,13 @@ public class EssentialsUpgrade {
|
||||
}
|
||||
|
||||
public void convertIgnoreList() {
|
||||
Pattern pattern = Pattern.compile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
|
||||
if (doneFile.getBoolean("updateUsersIgnoreListUUID", false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.info("Attempting to migrate ignore list to UUIDs");
|
||||
|
||||
final File userdataFolder = new File(ess.getDataFolder(), "userdata");
|
||||
if (!userdataFolder.exists() || !userdataFolder.isDirectory()) {
|
||||
return;
|
||||
@ -65,6 +69,10 @@ public class EssentialsUpgrade {
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
if (pattern.matcher(name.trim()).matches()) {
|
||||
LOGGER.info("Detected already migrated ignore list!");
|
||||
return;
|
||||
}
|
||||
User user = ess.getOfflineUser(name);
|
||||
if (user != null && user.getBase() != null) {
|
||||
migratedIgnores.add(user.getBase().getUniqueId().toString());
|
||||
@ -81,6 +89,7 @@ public class EssentialsUpgrade {
|
||||
}
|
||||
doneFile.setProperty("updateUsersIgnoreListUUID", true);
|
||||
doneFile.save();
|
||||
LOGGER.info("Done converting ignore list.");
|
||||
}
|
||||
|
||||
public void convertKits() {
|
||||
|
@ -21,7 +21,7 @@ public class Commandignore extends EssentialsCommand {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (UUID uuid : user._getIgnoredPlayers()) {
|
||||
User curUser = ess.getUser(uuid);
|
||||
if (curUser != null && curUser.getName() != null && !curUser.getName().trim().equals("")) {
|
||||
if (curUser != null && curUser.getName() != null && !curUser.getName().trim().isEmpty()) {
|
||||
sb.append(curUser.getName()).append(" ");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user