Package org.freerealm.executor

Examples of org.freerealm.executor.CommandResult


    public CommandResult execute(Realm realm) {
        this.realm = realm;
        manageUnits();
        player.setTurnEnded(false);
        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 ((name == null) || (name.trim().equals(""))) {
            return new CommandResult(CommandResult.RESULT_ERROR, "Settlement name cannot be empty");
        }
        settlement.setName(name);
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

            if (unit.getNextOrder() == null) {
                order.setTurnGiven(realm.getNumberOfTurns());
            }
            unit.addOrder(order);
            Executor.getInstance().execute(new UnitOrderExecuteCommand(unit));
            return new CommandResult(CommandResult.RESULT_OK, "", CommandResult.UNIT_ORDER_ASSIGNED_UPDATE);
        } else {
            return new CommandResult(CommandResult.RESULT_ERROR, "Unit can not be null");
        }
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        if (player1 == null || player2 == null) {
            return new CommandResult(CommandResult.RESULT_ERROR, "", CommandResult.NO_UPDATE);
        } else {
            realm.getDiplomacy().addPlayerRelation(player1, player2, status);
            return new CommandResult(CommandResult.RESULT_OK, "Players must not be null", CommandResult.DIPLOMATIC_STATUS_UPDATE);
        }
    }
View Full Code Here

     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        if (unit != null) {
            unit.clearOrders();
            return new CommandResult(CommandResult.RESULT_OK, "");
        } else {
            return new CommandResult(CommandResult.RESULT_ERROR, "Unit can not be null");
        }
    }
View Full Code Here

        Iterator<Unit> unitsIterator = units.iterator();
        while (unitsIterator.hasNext()) {
            Unit unit = unitsIterator.next();
            Executor.getInstance().execute(new RemoveUnitCommand(player, unit));
        }
        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);
        }
        player.removeUnit(unit);
        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) {
            return new CommandResult(CommandResult.RESULT_ERROR, "Unit is null", CommandResult.NO_UPDATE);
        }
        if (movementPoints < 0) {
            return new CommandResult(CommandResult.RESULT_ERROR, "movementPoints is less than zero", CommandResult.NO_UPDATE);
        }
        unit.setMovementPoints(movementPoints);
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

    public CommandResult execute(Realm realm) {
        SettlementImprovement newImprovement = new SettlementImprovement();
        newImprovement.setType(improvementType);
        newImprovement.setEnabled(true);
        settlement.addImprovement(newImprovement);
        return new CommandResult(CommandResult.RESULT_OK, "");
    }
View Full Code Here

     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        player.setWealth(player.getWealth() + amount);
        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.