Package mage.interfaces.callback

Examples of mage.interfaces.callback.ClientCallback


        messageData.add(message);
        fireCallback(new ClientCallback("showUserMessage", null, messageData ));
    }

    public boolean watchGame(final UUID gameId) {
        fireCallback(new ClientCallback("watchGame", gameId));
        return true;
    }
View Full Code Here


        fireCallback(new ClientCallback("watchGame", gameId));
        return true;
    }

    public void replayGame(final UUID gameId) {
        fireCallback(new ClientCallback("replayGame", gameId));
    }
View Full Code Here

        }
    }

    public boolean broadcastInfoToUser(User toUser, String message) {
        if (clients.containsKey(toUser.getId())) {
            toUser.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(null, message, timeFormatter.format(new Date()), MessageColor.BLUE, MessageType.USER_INFO, null)));
            return true;
        }
        return false;
    }
View Full Code Here

        return false;
    }

    public boolean broadcastWhisperToUser(User fromUser, User toUser, String message) {
        if (clients.containsKey(toUser.getId())) {
            toUser.fireCallback(new ClientCallback("chatMessage", chatId,
                    new ChatMessage(new StringBuilder("Whisper from ").append(fromUser.getName()).toString(), message, timeFormatter.format(new Date()), MessageColor.YELLOW, MessageType.WHISPER, SoundToPlay.PlayerWhispered)));
            if (clients.containsKey(fromUser.getId())) {
                fromUser.fireCallback(new ClientCallback("chatMessage", chatId,
                        new ChatMessage(new StringBuilder("Whisper to ").append(toUser.getName()).toString(), message, timeFormatter.format(new Date()), MessageColor.YELLOW, MessageType.WHISPER, null)));
                return true;
            }
        }
        return false;
View Full Code Here

            final String username = userName;
            logger.trace("Broadcasting '" + msg + "' for " + chatId);
            for (UUID userId: clients.keySet()) {
                User user = UserManager.getInstance().getUser(userId);
                if (user != null) {
                    user.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color, messageType, soundToPlay)));
                }
                else {
                    logger.error("User not found but connected to chat - userId: " + userId + "  chatId: " + chatId);
                    clientsToRemove.add(userId);
                    remove = true;
View Full Code Here

        if (!killed) {
            User user = UserManager.getInstance().getUser(userId);
            if (user != null) {
                if (futureTimeout != null && !futureTimeout.isDone()) {
                    int remaining = (int) futureTimeout.getDelay(TimeUnit.SECONDS);
                    user.fireCallback(new ClientCallback("draftInit", draft.getId(), new DraftClientMessage(getDraftPickView(remaining))));
                }
                return true;
            }
        }
        return false;
View Full Code Here

    public void update() {
        if (!killed) {
            User user = UserManager.getInstance().getUser(userId);
            if (user != null) {
                user.fireCallback(new ClientCallback("draftUpdate", draft.getId(), getDraftView()));
            }
        }
    }
View Full Code Here

    //
    public void inform(final String message) {
        if (!killed) {
            User user = UserManager.getInstance().getUser(userId);
            if (user != null) {
                user.fireCallback(new ClientCallback("draftInform", draft.getId(), new DraftClientMessage(getDraftView(), message)));
            }
        }
    }
View Full Code Here

    public void draftOver() {
        if (!killed) {
            User user = UserManager.getInstance().getUser(userId);
            if (user != null) {
                user.fireCallback(new ClientCallback("draftOver", draft.getId()));
            }
        }
    }
View Full Code Here

    public void pickCard(int timeout) {
        if (!killed) {
            setupTimeout(timeout);
            User user = UserManager.getInstance().getUser(userId);
            if (user != null) {
                user.fireCallback(new ClientCallback("draftPick", draft.getId(), new DraftClientMessage(getDraftPickView(timeout))));
            }
        }
    }
View Full Code Here

TOP

Related Classes of mage.interfaces.callback.ClientCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.