Package org.freerealm.executor

Examples of org.freerealm.executor.CommandResult


     * @param realm Realm to execute the command
     * @return CommandResult
     */
    public CommandResult execute(Realm realm) {
        if (amount > source.getResourceQuantity(resource)) {
            return new CommandResult(CommandResult.RESULT_ERROR, "Not enough resource");
        }
        if (destination.getRemainingCapacity(resource) < amount) {
            amount = destination.getRemainingCapacity(resource);
        }
        source.setResourceQuantity(resource, source.getResourceQuantity(resource) - amount);
        destination.setResourceQuantity(resource, destination.getResourceQuantity(resource) + 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.