# Система менеджеров

Вся логика плагинов с BedrockLib строиться на взаимодействии между собой менедджеров.

### Класс Manager

**Менеджер (Manager)** - это логическая единица, выполняющаяя какую-либо логику, например обработчик команды, и имеющая доступ к экземпляру главного класса, который имеет доступ к остальным менеджерам.

```java
@Command(name = "join")
public class JoinCommand extends Manager<ArcadeLobby> {

    public JoinCommand(ArcadeLobby plugin) {
        super(plugin);
    }

    @Execute
    public String joinMinigame(@Context Player player, @Arg Minigame minigame) {
        Party party = getPlugin().getPartyManager().getByPlayer(player.getName());
        if (party == null) party = new Party(player);
        getPlugin().getMinigameManager().joinMinigame(minigame, party);
        return LangConfig.Command.JOIN_SUCCESS;
    }

}
```

{% hint style="info" %}
**Вот так выглядит обработчик команды join в моем плагине ArcadeLobby**
{% endhint %}

### Класс RunnableManager

Часто для написания класса сессии для какой-нибудь миниигры требуется использовать BukkitRunnable, но при этом нужны функции Manager, для таких случаев я сделал RunnableManager.


---

# 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://mrbedrockpys-plugins.gitbook.io/mrbedrockpys-plugins-docs/bedrocklib/sistema-menedzherov.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.
