Cheaper check

This commit is contained in:
Len 2022-08-28 23:46:36 +02:00
parent 9f5d979584
commit a9dff7fb68

View File

@ -150,16 +150,16 @@ public class EconUser {
if (addQueue.isEmpty() && removeQueue.isEmpty()) if (addQueue.isEmpty() && removeQueue.isEmpty())
return; return;
Object2ObjectOpenHashMap<UUID, EconUser> tmp = new Object2ObjectOpenHashMap<>(users); Object2ObjectOpenHashMap<UUID, EconUser> tmp = new Object2ObjectOpenHashMap<>(users);
while (!addQueue.isEmpty()) { while (true) {
EconUser user = addQueue.poll(); EconUser user = addQueue.poll();
if (user == null) if (user == null)
continue; break;
tmp.put(user.getUuid(), user); tmp.put(user.getUuid(), user);
} }
while (!removeQueue.isEmpty()) { while (true) {
EconUser user = addQueue.poll(); EconUser user = addQueue.poll();
if (user == null) if (user == null)
continue; break;
tmp.remove(user.getUuid()); tmp.remove(user.getUuid());
} }
users = tmp; users = tmp;