Search in sources :

Example 11 with ClientCallback

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);
}
Also used : ClientCallback(mage.interfaces.callback.ClientCallback) TableClientMessage(mage.view.TableClientMessage)

Example 12 with ClientCallback

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;
}
Also used : ClientCallback(mage.interfaces.callback.ClientCallback) User(mage.server.User) DraftClientMessage(mage.view.DraftClientMessage)

Example 13 with ClientCallback

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))));
}
Also used : ClientCallback(mage.interfaces.callback.ClientCallback) GameView(mage.view.GameView)

Example 14 with ClientCallback

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));
        }
    }
}
Also used : ClientCallback(mage.interfaces.callback.ClientCallback) User(mage.server.User)

Aggregations

ClientCallback (mage.interfaces.callback.ClientCallback)14 User (mage.server.User)3 ChatMessage (mage.view.ChatMessage)2 DraftClientMessage (mage.view.DraftClientMessage)2 NotBoundException (java.rmi.NotBoundException)1 RemoteException (java.rmi.RemoteException)1 LocateRegistry (java.rmi.registry.LocateRegistry)1 Registry (java.rmi.registry.Registry)1 java.util (java.util)1 TimeUnit (java.util.concurrent.TimeUnit)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Lock (java.util.concurrent.locks.Lock)1 ReadWriteLock (java.util.concurrent.locks.ReadWriteLock)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 MageException (mage.MageException)1 Constants (mage.constants.Constants)1 MageException (mage.interfaces.MageException)1