Package org.freerealm.executor

Examples of org.freerealm.executor.CommandResult


     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        realm.getWorldMap().getTile(coordinate).setBonusResource(bonusResource);
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here


     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        unitContainer.removeUnit(unit.getId());
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

        realm.setHistory(new FreeRealmHistory());
        realm.setWorldMap(new WorldMap());
        realm.setPathFinder(null);
        realm.setNumberOfTurns(0);
        realm.setManagedObjectCount(0);
        return new CommandResult(CommandResult.NO_UPDATE, "");
    }
View Full Code Here

        InputSource inputSource = new InputSource(bufferedInputStream);
        DOMParser builder = new DOMParser();
        try {
            builder.parse(inputSource);
        } catch (SAXException exception) {
            return new CommandResult(CommandResult.RESULT_ERROR, "SAXException : " + exception.getMessage());
        } catch (IOException exception) {
            return new CommandResult(CommandResult.RESULT_ERROR, "IOException : " + exception.getMessage());
        }
        NodeList nodeList = builder.getDocument().getElementsByTagName("WorldMap");
        Node worldMapNode = nodeList.item(0);
        WorldMap worldMap = new WorldMap();
        (new WorldMapXMLWrapper(worldMap)).initializeFromNode(realm, worldMapNode);
        realm.setWorldMap(worldMap);
        realm.setPathFinder(new AStarPathFinder(realm, 100));
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        if ((unit != null) && (!player.hasUnit(unit))) {
            return new CommandResult(CommandResult.RESULT_ERROR, "Unit does not belong to active user", CommandResult.NO_UPDATE);
        }
        if (player.getActiveUnit() != null && player.getActiveUnit().equals(unit)) {
            player.setActiveUnit(null);
        }
        unit.setMovementPoints(0);
        unit.setStatus(Unit.UNIT_SUSPENDED);
        realm.getWorldMap().removeUnit(unit);
        unit.setCoordinate(null);
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        int newPlayerId = player.getId();
        if (realm.getPlayerManager().getPlayer(newPlayerId) != null) {
            return new CommandResult(CommandResult.RESULT_ERROR, "A player with given id already exists");
        }
        realm.getPlayerManager().addPlayer(player);
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        if (storer.getRemainingCapacity(resource) < amount) {
            return new CommandResult(CommandResult.RESULT_ERROR, "");
        }
        storer.setResourceQuantity(resource, storer.getResourceQuantity(resource) + amount);
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        realm.getWorldMap().getTile(coordinate).setType(tileType);
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        init(realm);
        return new CommandResult(CommandResult.REALM_INITIALIZE_UPDATE, "");
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        settlement.removeFromProductionQueue(index);
        return new CommandResult(CommandResult.RESULT_OK, "");

    }
View Full Code Here

TOP

Related Classes of org.freerealm.executor.CommandResult

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.