# Annotations

## @IocBukkitCommandHandler

Specify this bean as a command executor. [More info](https://staffplusplus-minecraft.gitbook.io/tubing/dependency-injection/commands)

| property | description                                            |
| -------- | ------------------------------------------------------ |
| value    | The name of the command as specified in the plugin.yml |

```java
@IocBukkitCommandHandler("broadcast")
public class BroadcastCmd implements CommandExecutor {

    private final MessageService messageService;
    private final BroadcastingService broadcastingService;

    public BroadcastCmd(MessageService messageService, BroadcastingService broadcastingService) {
        this.messageService = messageService;
        this.broadcastingService = broadcastingService;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
     ...
    }
}
```

## @IocBukkitListener

Specify this bean as a Bukkit event listener.

```java
@IocBukkitListener
public class PlayerJoinListener implements Listener {

    @EventHandler(priority = EventPriority.NORMAL)
    public void onJoin(PlayerJoinEvent event) {
        ...
    }
}
```

## @IocBukkitMessageListener

Specify this bean as a Bungee message listener.

```java
@IocBukkitMessageListener(channel = "BungeeCord")
public class BroadcastedMessageBungeeReceiver implements PluginMessageListener {

    private final BungeeService bungeeService;

    public BroadcastedMessageBungeeReceiver(BungeeService bungeeService) {
        this.bungeeService = bungeeService;
    }

    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        Optional<BungeeBroadcastedMessage> bungeeMessage = bungeeService.handleReceived(channel, BUNGEE_REPORT_MESSAGE_BROADCAST_CHANNEL, message, BungeeBroadcastedMessage.class);
        bungeeMessage.map(BungeeBroadcastedMessage::getBroadcastedMessage).ifPresent(b -> Bukkit.getPluginManager().callEvent(new BroadcastedMessageReceivedBungeeEvent(b)));
    }
}
```

| property | Description                                      |
| -------- | ------------------------------------------------ |
| channel  | The channel on which the listener should listen. |

##


---

# Agent Instructions: 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://staffplusplus-minecraft.gitbook.io/tubing/dependency-injection/annotations.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.
