> 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

## 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.


---

# 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:

```
GET https://rocketpencil-studios.gitbook.io/delegate/commands/first-command.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
