Cleanup subscription updates & UserManager#loadAllUsers

This commit is contained in:
Luck
2017-09-13 20:18:37 +01:00
Unverified
parent b1584aa2c3
commit 2412edaa3a
5 changed files with 33 additions and 29 deletions
@@ -207,16 +207,14 @@ public class SpongeUserManager implements UserManager, LPSubjectCollection {
}
@Override
public void updateAllUsers() {
plugin.doSync(() -> {
Set<UUID> players = plugin.getOnlinePlayers();
plugin.doAsync(() -> {
for (UUID uuid : players) {
UUID internal = plugin.getUuidCache().getUUID(uuid);
plugin.getStorage().loadUser(internal, "null").join();
}
});
});
public CompletableFuture<Void> updateAllUsers() {
return CompletableFuture.supplyAsync(plugin::getOnlinePlayers, plugin.getScheduler().sync())
.thenAcceptAsync(players -> {
for (UUID uuid : players) {
UUID internal = plugin.getUuidCache().getUUID(uuid);
plugin.getStorage().loadUser(internal, "null").join();
}
}, plugin.getScheduler().async());
}
/* ------------------------------------------