Search in sources :

Example 1 with DraftClientMessage

use of mage.view.DraftClientMessage in project mage by magefree.

the class DraftSession method pickCard.

public void pickCard(int timeout) {
    if (!killed) {
        setupTimeout(timeout);
        managerFactory.userManager().getUser(userId).ifPresent(user -> user.fireCallback(new ClientCallback(ClientCallbackMethod.DRAFT_PICK, draft.getId(), new DraftClientMessage(getDraftView(), getDraftPickView(timeout)))));
    }
}
Also used : ClientCallback(mage.interfaces.callback.ClientCallback) DraftClientMessage(mage.view.DraftClientMessage)

Example 2 with DraftClientMessage

use of mage.view.DraftClientMessage 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)

Aggregations

ClientCallback (mage.interfaces.callback.ClientCallback)2 DraftClientMessage (mage.view.DraftClientMessage)2 User (mage.server.User)1