package top.r3944realms.lib39.core.command;

import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraftforge.event.RegisterCommandsEvent;
import org.jetbrains.annotations.NotNull;

/**
 * The type Simple help command.
 */
public abstract class SimpleHelpCommand implements IHelpCommand {
    /**
     * The Root.
     */
    protected final LiteralArgumentBuilder<CommandSourceStack> root;

    /**
     * Instantiates a new Simple help command.
     *
     * @param event the event
     */
    public SimpleHelpCommand(@NotNull RegisterCommandsEvent event) {
        root = buildCommand(event.getDispatcher(), event.getBuildContext());
    }

    /**
     * Instantiates a new Simple help command.
     *
     * @param dispatcher the dispatcher
     * @param context    the context
     */
    public SimpleHelpCommand(CommandDispatcher<CommandSourceStack> dispatcher,
                                 CommandBuildContext context) {
        root = buildCommand(dispatcher, context);
    }

    /**
     * Gets root.
     *
     * @return the root
     */
    public LiteralArgumentBuilder<CommandSourceStack> getRoot() {
        return root;
    }
}
