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

# First Command

This page will describe how you can create your first command with Delegate

## Hooking

Delegate is platform agnostic, but it still needs a way to hook itself into the platform you are using. This is done by **hooking** your plugin. Hooking your plugin is easy. The example below shows you how to hook using the Paper/Spigot/Bukkit implementation.

```java
Plugin plugin = Bukkit.getServer().getPluginManager("<your plugin>");
Delegate.hook(plugin);
```

{% hint style="danger" %}
Make sure to hook your plugin. If your plugin is not hooked, commands will not work!
{% endhint %}

## Your First Command

```java
public class Example {
    
    /**
      * Creates a simple "Hello, World!" command.
      */
    public void createCommand() {
        Delegate.create("hello", "Sends hello to the whole server")
            .withAction(() -> Bukkit.broadcastMessage("Hello, World!"))
            .build();
    }
    
}
```

Let's break down what is happening here. A command in delegate is **always** created using the *`create()`*-method which can be called on the `Delegate` object:

```java
Delegate.create(String name, String description);
```

This will create a *`ICommandBuilder`* depending on your selected platform (e.g. if you are using the Paper implementation, this will be a `PaperCommandBuilder`). This is a builder that can be used to chain attributes to your command. Furthermore, depending on your platform, some builders may offer other attribute options. In the next section we'll take a closer look at what these command attributes are.
