All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.forthecrown.grenadier.annotations.Argument Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package net.forthecrown.grenadier.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Parameter annotation for command execution methods.
 * 

* Use this annotation if you're seeing error messages along the lines of * {@code Argument 'arg2' is not available in the current context} As that means * java has gotten rid of the parameter names. * *

* Use example:


 * public void runCommand(@Argument("value") int value) {
 *
 * }
 * 
*/ @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) public @interface Argument { /** * Name of the argument within the {@link com.mojang.brigadier.context.CommandContext} * @return Argument name */ String value() default ""; /** * Determines if the argument is required for the command's execution. If set * to {@code false}, then the parameter this is annotated with may be null if * the command doesn't have the argument * * @return {@code true} if the argument is optional, {@code false} otherwise */ boolean optional() default false; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy