Mostly code format fixes.

This commit is contained in:
vraskulin 2017-02-09 18:30:31 +03:00
parent 7cf4ca3cae
commit f99cd21275
37 changed files with 226 additions and 189 deletions

View file

@ -95,11 +95,7 @@ public class TableController {
if (userId != null) {
Optional<User> user = UserManager.getInstance().getUser(userId);
// TODO: Handle if user == null
if (user.isPresent()) {
controllerName = user.get().getName();
} else {
controllerName = "undefined";
}
controllerName = user.map(User::getName).orElse("undefined");
} else {
controllerName = "System";
}
@ -671,9 +667,7 @@ public class TableController {
if (entry.getValue().equals(playerId)) {
Optional<User> user = UserManager.getInstance().getUser(entry.getKey());
int remaining = (int) futureTimeout.getDelay(TimeUnit.SECONDS);
if (user.isPresent()) {
user.get().ccSideboard(deck, table.getId(), remaining, options.isLimited());
}
user.ifPresent(user1 -> user1.ccSideboard(deck, table.getId(), remaining, options.isLimited()));
break;
}
}
@ -811,10 +805,7 @@ public class TableController {
private synchronized void setupTimeout(int seconds) {
cancelTimeout();
if (seconds > 0) {
futureTimeout = timeoutExecutor.schedule(
() -> autoSideboard(),
seconds, TimeUnit.SECONDS
);
futureTimeout = timeoutExecutor.schedule(this::autoSideboard, seconds, TimeUnit.SECONDS);
}
}