Package org.terasology.logic.console

Examples of org.terasology.logic.console.Command


    public CommandInfo(Method method, Object provider) {
        this.method = method;
        this.provider = provider;
        this.name = method.getName();
        Command commandAnnotation = method.getAnnotation(Command.class);
        if (commandAnnotation == null) {
            throw new IllegalArgumentException("Method not annotated with command");
        }
        for (int i = 0; i < method.getParameterTypes().length; ++i) {
            Class<?> parameterType = method.getParameterTypes()[i];
            if (i == method.getParameterTypes().length - 1 && parameterType == EntityRef.class) {
                clientEntityRequired = true;
            } else {
                String paramType = parameterType.getSimpleName().toLowerCase();
                String paramName = getParamName(i);
               
                if (paramName == null) {
                    paramName = "p" + i;
                    logger.warn("Parameter {} in method {} does not have a CommandParam annotation", i, method);
                }

                parameterNames.add(paramName);
                parameterTypes.add(paramType);
            }
        }
        this.runOnServer = commandAnnotation.runOnServer();
        this.shortDescription = commandAnnotation.shortDescription();
        this.helpText = commandAnnotation.helpText();
    }
View Full Code Here

TOP

Related Classes of org.terasology.logic.console.Command

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.