net.forthecrown.grenadier.annotations.compiler.ParamFiller 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.suggestion.SuggestionsBuilder;
import net.forthecrown.grenadier.annotations.util.ExpandedCommandContext;
import org.jetbrains.annotations.Nullable;
interface ParamFiller {
ParamFiller CONTEXT = (context, builder) -> context.getBase();
ParamFiller SOURCE = (context, builder) -> context.getSource();
ParamFiller BUILDER = (context, builder) -> builder;
Object getValue(
ExpandedCommandContext context,
@Nullable SuggestionsBuilder builder
);
record ArgumentFiller(String name, boolean optional, Class> type)
implements ParamFiller
{
@Override
public Object getValue(
ExpandedCommandContext context,
@Nullable SuggestionsBuilder builder
) {
return context.getValue(name, type, optional);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy