use of io.github.nucleuspowered.nucleus.configurate.datatypes.UserCacheDataNode in project Nucleus by NucleusPowered.
the class UserCacheService method fileWalk.
public boolean fileWalk() {
synchronized (lockingObject) {
if (isWalking) {
return false;
}
isWalking = true;
}
try {
Map<UUID, UserCacheDataNode> data = Maps.newHashMap();
List<UUID> knownUsers = Sponge.getServiceManager().provideUnchecked(UserStorageService.class).getAll().stream().map(Identifiable::getUniqueId).collect(Collectors.toList());
int count = 0;
UserDataManager manager = Nucleus.getNucleus().getUserDataManager();
for (UUID user : knownUsers) {
if (manager.has(user)) {
manager.get(user).ifPresent(x -> data.put(user, new UserCacheDataNode(x)));
if (++count >= 10) {
manager.removeOfflinePlayers();
count = 0;
}
}
}
this.data = new UserCacheVersionNode();
this.data.getNode().putAll(data);
save();
} finally {
isWalking = false;
}
return true;
}
Aggregations