En
# VCChat
A **Paper / Purpur** plugin (Minecraft, API `1.21`) that adds **local chat** (radius around the player) and **global chat** (message prefix), formatting via **Vault** and **PlaceholderAPI**, player mentions, custom join/quit messages, optional **GigaChatPlugin** integration, and forwarding GigaChat bot replies to **Discord** via **DiscordSRV**.
---
## Features
- **Local chat** — only players within a configurable **radius** in the same world hear you.
- **Global chat** — message starts with a configurable prefix (default `!`); everyone online sees it.
- **Formats** for local and global: `{prefix}`, `{suffix}`, `{displayname}`, `{message}`, PlaceholderAPI (`%...%`).
- **Vault** — prefix/suffix from your permissions plugin (LuckPerms, etc.) when Vault is installed.
- **`@player` mentions** — highlight and sound for the mentioned player.
- Configurable **join** / **quit** messages (can be disabled).
- **GigaChat** — address the bot by alias (e.g. `@gigachat question`); the reply goes to the same channel (local or global) as the question.
- Optional suppression of the “nobody heard you” message when talking to GigaChat in an empty local radius.
- **DiscordSRV** — optional forwarding of **GigaChat reply text** to a Discord channel (global and/or local questions — separate flags).
---
## Requirements
- **Paper** or **Purpur** with a current 1.21 API branch (see `build.gradle`).
- **Java** compatible with your server build (usually 21+).
### Optional plugins
| Plugin | Purpose |
|--------|---------|
| **PlaceholderAPI** | Extra placeholders in chat and join/quit formats |
| **Vault** + permissions plugin | Prefix/suffix in messages |
| **GigaChatPlugin** | GigaChat requests via Bukkit service |
| **DiscordSRV** | Forward bot replies to Discord |
VCChat **does not require** these; without them some features are disabled or simplified (e.g. empty prefixes without Vault).
---
## Installation
1. Use **Paper/Purpur** — not bare Spigot without the APIs this plugin needs (`AsyncChatEvent`).
2. Copy **`VCChat-*.jar`** into **`plugins`**.
3. For GigaChat and/or Discord, install **GigaChatPlugin** and/or **DiscordSRV** (install **before** or alongside VCChat; load order is usually not critical).
4. **Fully restart** the server.
5. Edit **`plugins/VCChat/config.yml`** for your server (see below).
6. Run **`/vcchat reload`** or restart again to apply config.
---
## Configuring `config.yml`
Created on first run: **`plugins/VCChat/config.yml`**.
### Local and global chat
| Key | Description |
|-----|-------------|
| `local-chat.radius` | Radius in blocks; recipients are in the same world within that sphere |
| `global-prefix` | Prefix at the start of a message for global (the prefix itself is stripped from chat text) |
| `formats.local`, `formats.global` | Message templates (see comments in the bundled config) |
| `no-one-heard` | Message to the player in local chat when nobody else is in range |
### Permissions
| Permission | Purpose | Default |
|------------|---------|---------|
| `vcchat.local` | Use local chat | true |
| `vcchat.global` | Use global chat (with prefix) | true |
| `vcchat.admin.reload` | `/vcchat reload` | op |
### Mentions and join/quit
Sections **`mention`**, **`join`**, **`quit`** — colours, sounds, text; join/quit support PAPI placeholders.
### GigaChat integration (`gigachat`)
Enable with **`gigachat.enabled: true`**.
| Option | Meaning |
|--------|---------|
| `alias` | Trigger in text, e.g. `@gigachat` |
| `bot-name`, `bot-prefix` | Bot display when using “reply like player” mode |
| `reply-like-player` | Format the reply like a player message |
| `reply-like-player-local-format` / `reply-like-player-global-format` | Separate formats without clan placeholders |
| `thinking-enabled` / `thinking-message` | Private “request sent…” message |
| `format`, `error-format`, `scope-tag-*` | Reply and error appearance |
| `suppress-no-one-heard` | Hide “nobody heard you” when addressing GigaChat |
| `alias-color` | Highlight colour for the alias in the player’s message |
**Important:** in **GigaChatPlugin** `config.yml`, set **`chat-listener-enabled: false`**, otherwise you may get **two** replies.
### Forwarding replies to Discord (`gigachat.discord`)
Requires **DiscordSRV** with channels configured in its `config.yml` (**Channels** section).
| Option | Description |
|--------|-------------|
| `enabled` | Master switch for forwarding |
| `channel` | Game channel name from DiscordSRV (often `global`) |
| `send-global` | Forward replies to questions asked in **global** chat |
| `send-local` | Forward replies to questions asked in **local** chat |
| `format` | Discord message string; **`{player}`**, **`{answer}`** |
---
Spoiler
## Working with GigaChatPlugin
1. Install **GigaChatPlugin**, configure **`gigachat.yml`** (API keys, model, TLS if needed).
2. In GigaChatPlugin: **`chat-listener-enabled: false`**.
3. In VCChat: configure **`gigachat`** and optionally **`gigachat.discord`**.
4. Full restart after initial setup; later VCChat edits via **`/vcchat reload`**.
GigaChat request permissions are defined in **GigaChatPlugin** (`gigachat.ask`, etc.).
---
## FAQ
**Why don’t local messages go to Discord, but GigaChat replies did?**
Local chat is **cancelled** early in the event pipeline so DiscordSRV does not treat it as normal chat. Bot replies to Discord are sent **separately** through DiscordSRV’s API when `gigachat.discord` is enabled.
**“Internal GigaChat bridge error”**
Usually GigaChatPlugin failed to load or did not register the service. Check startup logs and that the JAR is present.
Ru
Плагин для **Paper / Purpur** (Minecraft, API `1.21`) добавляет **локальный чат** (по радиусу от игрока) и **глобальный чат**, форматирование через **Vault** и **PlaceholderAPI**, упоминания игроков, кастомные сообщения входа/выхода, опциональную интеграцию с **GigaChatPlugin** и пересылку ответов бота в **Discord** через **DiscordSRV**.
---
## Возможности
- **Локальный чат** — видят только игроки в заданном **радиусе** в том же мире.
- **Глобальный чат** — сообщение начинается с настраиваемого префикса (по умолчанию `!`); видят все онлайн.
- **Форматы** для локального и глобального канала: `{prefix}`, `{suffix}`, `{displayname}`, `{message}`, плейсхолдеры PlaceholderAPI (`%...%`).
- **Vault** — префикс и суффикс из плагина прав (LuckPerms и др.), если Vault установлен.
- Упоминания **`@ник`** — подсветка и звук у адресата.
- Настраиваемые сообщения **join** / **quit** (можно отключить).
- **GigaChat** — обращение по алиасу (например `@gigachat вопрос`); ответ приходит в тот же канал (локальный или глобальный), что и вопрос.
- Подавление сообщения «никто не услышал» при обращении к GigaChat в пустом локале (настраивается).
- **DiscordSRV** — опциональная отправка **текста ответа GigaChat** в выбранный Discord-канал (глобальные и/или локальные вопросы — отдельными флагами).
---
## Требования
- **Paper** или **Purpur** с актуальным API ветки 1.21 (см. версию в `build.gradle`).
- **Java**, совместимая с вашей сборкой сервера (обычно 21+).
### Опциональные плагины
| Плагин | Зачем |
|--------|--------|
| **PlaceholderAPI** | Расширенные плейсхолдеры в форматах чата и join/quit |
| **Vault** + плагин прав | Префикс/суффикс в формате сообщения |
| **GigaChatPlugin** | Запросы к GigaChat через Bukkit-сервис |
| **DiscordSRV** | Пересылка ответов бота в Discord |
VCChat **не обязан** иметь эти плагины; без них часть функций отключается или упрощается (например, без Vault префиксы пустые).
---
## Установка
1. Убедитесь, что сервер — **Paper/Purpur**, не чистый Spigot без нужных API (используется `AsyncChatEvent`).
2. Скопируйте **`VCChat-*.jar`** в папку **`plugins`**.
3. Если нужны GigaChat и/или Discord — установите **GigaChatPlugin** и/или **DiscordSRV** (рекомендуется ставить **до** или вместе с VCChat; порядок загрузки обычно некритичен).
4. **Полностью перезапустите** сервер.
5. Отредактируйте **`plugins/VCChat/config.yml`** под свой сервер (см. ниже).
6. Выполните **`/vcchat reload`** или снова рестарт, чтобы применить конфиг.
---
## Настройка `config.yml`
Файл создаётся при первом запуске: **`plugins/VCChat/config.yml`**.
### Локальный и глобальный чат
| Ключ | Описание |
|------|----------|
| `local-chat.radius` | Радиус в блоках; в локальный чат попадают игроки в том же мире внутри сферы |
| `global-prefix` | Символ(ы) в начале сообщения для глобала (сам префикс в текст чата не попадает) |
| `formats.local`, `formats.global` | Шаблоны сообщений (см. комментарии в конфиге) |
| `no-one-heard` | Сообщение игроку в локале, если рядом никого нет |
### Права
| Право | Назначение | По умолчанию |
|-------|------------|----------------|
| `vcchat.local` | Писать в локальный чат | true |
| `vcchat.global` | Писать в глобальный | true |
| `vcchat.admin.reload` | Команда `/vcchat reload` | op |
### Упоминания и join/quit
Секции **`mention`**, **`join`**, **`quit`** — цвет, звук, тексты; в join/quit работают плейсхолдеры PAPI.
### Интеграция с GigaChat (`gigachat`)
Включение: **`gigachat.enabled: true`**.
| Параметр | Смысл |
|----------|--------|
| `alias` | Триггер в тексте, например `@gigachat` |
| `bot-name`, `bot-prefix` | Отображение «бота» при режиме ответа как у игрока |
| `reply-like-player` | Ответ оформляется как сообщение игрока |
| `reply-like-player-local-format` / `reply-like-player-global-format` | Отдельные форматы без лишних клановых плейсхолдеров |
| `thinking-enabled` / `thinking-message` | Личное сообщение «запрос отправлен…» |
| `format`, `error-format`, `scope-tag-*` | Внешний вид ответа и ошибок |
| `suppress-no-one-heard` | Не показывать «никто не услышал», если игрок обратился к GigaChat |
| `alias-color` | Подсветка алиаса в сообщении игрока |
**Важно:** на стороне **GigaChatPlugin** в `config.yml` должно быть **`chat-listener-enabled: false`**, иначе возможны **два ответа** на одно обращение.
### Пересылка ответов в Discord (`gigachat.discord`)
Требуется установленный **DiscordSRV**, каналы настроены в его `config.yml` (секция **Channels**).
| Параметр | Описание |
|----------|----------|
| `enabled` | Мастер-включатель пересылки |
| `channel` | Имя игрового канала из DiscordSRV (часто `global`) |
| `send-global` | Пересылать ответы на вопросы из **глобального** чата |
| `send-local` | Пересылать ответы на вопросы из **локального** чата |
| `format` | Строка в Discord; **`{player}`**, **`{answer}`** |
---
## Совместная работа с GigaChatPlugin
1. Установите **GigaChatPlugin**, пропишите **`gigachat.yml`** (ключи API, модель, при необходимости TLS).
2. В GigaChatPlugin: **`chat-listener-enabled: false`**.
3. В VCChat: настройте секцию **`gigachat`** и при необходимости **`gigachat.discord`**.
4. Перезапуск сервера после первичной настройки; дальше правки VCChat — через **`/vcchat reload`**.
Права на запросы к GigaChat задаются в **GigaChatPlugin** (`gigachat.ask` и т.д.).
---
## Частые вопросы
**Почему локальные сообщения не уходят в Discord, а ответ GigaChat уходил?**
Локальный чат специально **отменяется** на раннем этапе обработки события, чтобы DiscordSRV не считал это обычным чатом. Ответ бота в Discord при включённой секции `gigachat.discord` отправляется **отдельно** через API DiscordSRV.
**Ошибка «внутренняя ошибка моста GigaChat»**
Обычно GigaChatPlugin не загрузился или не зарегистрировал сервис. Проверьте логи при старте и наличие JAR.
暂无评论,抢个沙发吧~