rewrote singleton to enum where applicable

This commit is contained in:
ingmargoudt 2017-03-14 16:31:57 +01:00
parent 3b62489ef5
commit 234cfe9519
872 changed files with 1796 additions and 2135 deletions

View file

@ -61,7 +61,7 @@ public class ChatSession {
}
public void join(UUID userId) {
UserManager.getInstance().getUser(userId).ifPresent(user-> {
UserManager.instance.getUser(userId).ifPresent(user-> {
if (!clients.containsKey(userId)) {
String userName = user.getName();
clients.put(userId, userName);
@ -142,7 +142,7 @@ public class ChatSession {
HashSet<UUID> clientsToRemove = null;
ClientCallback clientCallback = new ClientCallback("chatMessage", chatId, new ChatMessage(userName, message, (withTime ? timeFormatter.format(new Date()) : ""), color, messageType, soundToPlay));
for (UUID userId : clients.keySet()) {
Optional<User> user = UserManager.getInstance().getUser(userId);
Optional<User> user = UserManager.instance.getUser(userId);
if (user.isPresent()) {
user.get().fireCallback(clientCallback);
} else {