net.forthecrown.grenadier.annotations.compiler.CompiledExecutes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grenadier-annotations Show documentation
Show all versions of grenadier-annotations Show documentation
Annotation-based command support for Grenadier
package net.forthecrown.grenadier.annotations.compiler;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import it.unimi.dsi.fastutil.Pair;
import java.lang.reflect.Method;
import net.forthecrown.grenadier.CommandSource;
import net.forthecrown.grenadier.annotations.compiler.MemberChain.FieldMember;
import net.forthecrown.grenadier.annotations.compiler.MemberChain.MethodMember;
import net.forthecrown.grenadier.annotations.compiler.MemberChainCompiler.ChainCompileConfig;
import net.forthecrown.grenadier.annotations.tree.ExecutesTree.MemberExecutes;
import net.forthecrown.grenadier.annotations.util.Result;
class CompiledExecutes implements Command {
private final Object commandClass;
private final MemberChain chain;
private final ContextFactory factory;
private final ParamFiller[] fillers;
private final Object[] parameterBuffer;
public CompiledExecutes(
Object commandClass,
MemberChain chain,
ContextFactory factory,
ParamFiller[] fillers
) {
this.commandClass = commandClass;
this.chain = chain;
this.factory = factory;
this.fillers = fillers;
this.parameterBuffer = fillers == null ? null : new Object[fillers.length];
}
@Override
public int run(CommandContext context)
throws CommandSyntaxException
{
Pair
© 2015 - 2025 Weber Informatics LLC | Privacy Policy