> For the complete documentation index, see [llms.txt](https://docs.olziedev.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.olziedev.com/projects/nightmarket/api/commands.md).

# Creating Commands

## Creating Commands

In Player Auctions you can create a sub command that will allow you to create sub commands.

## Registering

You can register the commands using the [CommandRegistry](https://javadocs.olziedev.com/nightmarket/com/olziedev/nightmarket/api/market/command/CommandRegistry.html) to register your command.

Here is an example to register your command, instance is your expansions' instance.

```java
NightMarketAPI.getInstance().getCommandRegistry().addSubCommand(instance);
```

### Examples

Here is an example of a sub command class, this will let you be able to create sub commands.

```java
import com.olziedev.nightmarket.api.market.command.MCommand;
import org.bukkit.command.CommandSender;

import java.util.List;

public class ExampleCommand extends MCommand {

    public ExampleCommand() {
        super("example");
        this.executorType = ExecutorType.PLAYER_ONLY;
    }

    @Override
    public void execute(CommandSender sender, String[] arguments) {

    }

    @Override
    public List<String> onTabComplete(CommandSender sender, String[] arguments) {
        return super.onTabComplete(sender, arguments);
    }
}
```

The executor type is the type of executor that can execute the command, you can set it to PLAYER\_ONLY, CONSOLE\_ONLY, or null for both.

The onTabComplete method is a optional the method that will show a list of strings that will be shown to the player.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.olziedev.com/projects/nightmarket/api/commands.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
