Package agh.sr.rmi.exception

Examples of agh.sr.rmi.exception.GameException


    }

    @Override
    public void registerGameController(GameController gameController) throws GameException, RemoteException {
        if (botGameController != null) {
            throw new GameException("This bot already has a game listener registered!");
        }
        if (gameController == null) {
            throw new GameException("empty bot game listener");
        }
        this.botGameController = gameController;
    }
View Full Code Here


    }

    @Override
    public void addPlayer(PlayerToken playerToken, GameListener gameListener) throws GameException, RemoteException {
        if (playerToken == null) throw new GameException("Null player token");
        playerTokens.add(playerToken);
        gameListeners.add(gameListener);
        gameListener.registerGameController(this);
        startGameIfReady();
    }
View Full Code Here

    @Override
    public GameController createGame(PlayerToken playerToken, String gameName, int playersCount, int botsCount, GameListener gameListener) throws GameException, RemoteException {

        if (!players.containsValue(playerToken)) {
            throw new GameException("No such user registered on server!");
        }

        if (playersCount + botsCount >= MAX_NUMBER_OF_PLAYERS || playersCount + botsCount == 0) {
            throw new GameException("Bad number of players - game must contain 2-4 players!");
        }
        if (games.containsKey(gameName)) {
            throw new GameException("Not unique game name!");
        }

        List<Bot> bots = BotFactory.createBots(gameName, botsCount);

        GameController gameController = new PanGameController(gameName, playersCount, bots);
View Full Code Here

TOP

Related Classes of agh.sr.rmi.exception.GameException

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.