use of mage.interfaces.callback.ClientCallback in project mage by magefree.
the class User method ccSideboard.
public void ccSideboard(final Deck deck, final UUID tableId, final int time, boolean limited) {
fireCallback(new ClientCallback(ClientCallbackMethod.SIDEBOARD, tableId, new TableClientMessage(deck, tableId, time, limited)));
sideboarding.put(tableId, deck);
}
use of mage.interfaces.callback.ClientCallback in project mage by magefree.
the class DraftSession method init.
public boolean init() {
if (!killed) {
Optional<User> user = managerFactory.userManager().getUser(userId);
if (user.isPresent()) {
if (futureTimeout != null && !futureTimeout.isDone()) {
int remaining = (int) futureTimeout.getDelay(TimeUnit.SECONDS);
user.get().fireCallback(new ClientCallback(ClientCallbackMethod.DRAFT_INIT, draft.getId(), new DraftClientMessage(getDraftView(), getDraftPickView(remaining))));
}
return true;
}
}
return false;
}
use of mage.interfaces.callback.ClientCallback in project mage by magefree.
the class ReplaySession method replay.
public void replay() {
replay.start();
managerFactory.userManager().getUser(userId).ifPresent(user -> user.fireCallback(new ClientCallback(ClientCallbackMethod.REPLAY_INIT, replay.getGame().getId(), new GameView(replay.next(), replay.getGame(), null, null))));
}
use of mage.interfaces.callback.ClientCallback in project mage by magefree.
the class GameSessionPlayer method requestPermissionToSeeHandCards.
public void requestPermissionToSeeHandCards(UUID watcherId) {
if (!killed) {
Optional<User> watcher = userManager.getUser(watcherId);
Optional<User> user = userManager.getUser(userId);
if (user.isPresent() && watcher.isPresent()) {
UserRequestMessage userRequestMessage = new UserRequestMessage("User request", "Allow user <b>" + watcher.get().getName() + "</b> for this match to see your hand cards?<br>" + "(You can revoke this every time using related popup menu item of your battlefield.)");
userRequestMessage.setRelatedUser(watcherId, watcher.get().getName());
userRequestMessage.setGameId(game.getId());
userRequestMessage.setButton1("Accept", PlayerAction.ADD_PERMISSION_TO_SEE_HAND_CARDS);
userRequestMessage.setButton2("Reject", null);
user.get().fireCallback(new ClientCallback(ClientCallbackMethod.USER_REQUEST_DIALOG, game.getId(), userRequestMessage));
}
}
}
Aggregations