> For the complete documentation index, see [llms.txt](https://hcore.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hcore.gitbook.io/wiki/messaging/command-system.md).

# Command System

hCore allows you to create your custom commands without any editing plugin.yml.

## Introducing

Firstly, you need to create your command class.

Example code for ready command class:

```java
import com.hakan.core.command.executors.base.BaseCommand;
import com.hakan.core.command.executors.placeholder.Placeholder;
import com.hakan.core.command.executors.sub.SubCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

import java.util.ArrayList;
import java.util.List;

@BaseCommand(
        aliases = { "alias" } /* Aliases means like what label you need to use for this command*/,
        name = "example command",
        usage = "/customcommand",
        description = "This is the description of the custom command"
)
public class CustomCommand {

    @SubCommand(
            permission = "needed.permission",
            permissionMessage = "§cYou have no perms for using this command!"
    )
    public void mainCommand(CommandSender sender, String[] args) {
        sender.sendMessage("You used main command without any args! You also can use /alias for calling this command");
    }

    // After executing this command sender will get message if player is currently online or offline
    @SubCommand(
            permission = "online.check",
            args = { "<%player%>" }
    )
    public void checkOnlineCommand(CommandSender sender, String[] args) {
        sender.sendMessage("Player is currently " + (Bukkit.getOfflinePlayer(args[0]).isOnline() ? "online" : "offline"));
    }


    /* Placeholders allows you to add how many u want tab completions (in this situation is player names) */
    @Placeholder(
            name = "player"
    )
    public List<String> getPlayers() {
        return Bukkit.getOnlinePlayers().map(player -> player.name);
    }

}
```

## Placeholders

What is it?

Placeholders allows you to add a lot of args by using one method. So, you can add placeholder for anything you can imagine. For example: Loaded world names, Online players, Ready Values (100, 200, 300), e.t.c.

## SubCommands

SubCommand means arguments. You can provide permission to use this command and noPermission message.

You can also provide placeholders, using <%placeholderName%>, and arguments.

## Ending working with commands

After u created class, you need to register command. So, use the HCore#registerCommands(new YourCommandClass())
