    001/*
    002 * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License
    003 *
    004 *  Permission is hereby granted, free of charge, to any person obtaining
    005 *  a copy of this software and associated documentation files (the
    006 *  "Software"), to deal in the Software without restriction, including
    007 *  without limitation the rights to use, copy, modify, merge, publish,
    008 *  distribute, sublicense, and/or sell copies of the Software, and to
    009 *  permit persons to whom the Software is furnished to do so, subject to
    010 *  the following conditions:
    011 *
    012 *  The above copyright notice and this permission notice shall be
    013 *  included in all copies or substantial portions of the Software.
    014 *
    015 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    016 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    017 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    018 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    019 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    020 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    021 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    022 */
    023
    024package co.aikar.commands;
    025
    026import co.aikar.commands.annotation.Conditions;
    027
    028import java.lang.annotation.Annotation;
    029import java.util.List;
    030import java.util.Map;
    031
    032public class ParameterConditionContext <P, CEC extends CommandExecutionContext, I extends CommandIssuer> extends ConditionContext<I> {
    033
    034    private final CEC execContext;
    035
    036    ParameterConditionContext(RegisteredCommand cmd, I issuer, CEC execContext, Conditions conditions) {
    037        super(cmd, issuer, conditions);
    038
    039        this.execContext = execContext;
    040    }
    041
    042    public boolean isLastArg() {
    043        return execContext.isLastArg();
    044    }
    045
    046    public int getNumParams() {
    047        return execContext.getNumParams();
    048    }
    049
    050    public boolean canOverridePlayerContext() {
    051        return execContext.canOverridePlayerContext();
    052    }
    053
    054    public Object getResolvedArg(String arg) {
    055        return execContext.getResolvedArg(arg);
    056    }
    057
    058    public Object getResolvedArg(Class[] classes) {
    059        return execContext.getResolvedArg(classes);
    060    }
    061
    062    public Object getResolvedArg(String key, Class[] classes) {
    063        return execContext.getResolvedArg(key, classes);
    064    }
    065
    066    public boolean isOptional() {
    067        return execContext.isOptional();
    068    }
    069
    070    public Annotation getAnnotation(Class cls) {
    071        return execContext.getAnnotation(cls);
    072    }
    073
    074    public boolean hasAnnotation(Class cls) {
    075        return execContext.hasAnnotation(cls);
    076    }
    077
    078    public List<String> getArgs() {
    079        return execContext.getArgs();
    080    }
    081
    082    public int getIndex() {
    083        return execContext.getIndex();
    084    }
    085
    086    public Map<String, Object> getPassedArgs() {
    087        return execContext.getPassedArgs();
    088    }
    089
    090    public String joinArgs() {
    091        return execContext.joinArgs();
    092    }
    093
    094    public String joinArgs(String sep) {
    095        return execContext.joinArgs(sep);
    096    }
    097}