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

net.forthecrown.grenadier.annotations.compiler.ParamFiller Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
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