mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-06 18:50:54 +01:00
DataManager.removeData: Fix for consistency.
This commit is contained in:
parent
dd1da82abd
commit
67e993d597
@ -205,27 +205,22 @@ public class DataManager implements Listener, INotifyReload, INeedConfig, ICompo
|
||||
*/
|
||||
public static boolean removeData(final String playerName, CheckType checkType) {
|
||||
if (checkType == null) checkType = CheckType.ALL;
|
||||
|
||||
// Attempt for direct removal.
|
||||
CheckDataFactory dataFactory = checkType.getDataFactory();
|
||||
if (dataFactory != null) return dataFactory.removeData(playerName) != null;
|
||||
|
||||
// Remove all for which it seems necessary.
|
||||
final Set<CheckDataFactory> factories = new HashSet<CheckDataFactory>();
|
||||
for (CheckType otherType : CheckType.values()){
|
||||
if (checkType == CheckType.ALL || APIUtils.isParent(checkType, otherType)){
|
||||
final CheckDataFactory otherFactory = otherType.getDataFactory();
|
||||
if (otherFactory != null) factories.add(otherFactory);
|
||||
}
|
||||
}
|
||||
boolean had = false;
|
||||
for (final CheckDataFactory otherFactory : factories){
|
||||
if (otherFactory.removeData(playerName) != null) had = true;
|
||||
}
|
||||
|
||||
// Check extended registered components.
|
||||
if (clearComponentData(checkType, playerName)) had = true;
|
||||
|
||||
// Collect factories.
|
||||
final Set<CheckDataFactory> factories = new HashSet<CheckDataFactory>();
|
||||
for (CheckType otherType : APIUtils.getWithChildren(checkType)){
|
||||
final CheckDataFactory otherFactory = otherType.getDataFactory();
|
||||
if (otherFactory != null) factories.add(otherFactory);
|
||||
}
|
||||
// Remove data.
|
||||
for (final CheckDataFactory otherFactory : factories){
|
||||
if (otherFactory.removeData(playerName) != null) had = true;
|
||||
}
|
||||
|
||||
return had;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user