generate-plugin-message-handlerlisted
Install: claude install-skill MrPippi/MJP-Claude-Skills
# Generate Plugin Message Handler (Velocity) / 產生 Velocity 插件訊息處理器
## 技能名稱 / Skill Name
generate-plugin-message-handler
## 目的 / Purpose
為 Velocity proxy plugin 產生完整的 plugin messaging 處理類別,含頻道註冊、入站訊息解析、proxy 向後端回應的範例。
## 觸發條件 / Triggers
- 「plugin messaging on Velocity」
- 「PluginMessageEvent」
- 「proxy channel」
- 「傳訊息給後端伺服器」
- 「MinecraftChannelIdentifier」
- 「backend proxy communication」
## 輸入參數 / Inputs
| 參數 | 範例 | 說明 |
|------|------|------|
| `plugin_package` | `com.mynetwork.myplugin` | 插件套件名稱 |
| `channel_namespace` | `myplugin` | 頻道命名空間(小寫英數) |
| `channel_name` | `proxy` | 頻道名稱(結果為 `myplugin:proxy`) |
| `actions` | `["BROADCAST", "MOVE_PLAYER", "PLAYER_COUNT"]` | 要處理的 action 列表 |
## 輸出產物 / Outputs
- `messaging/ProxyMessagingHandler.java` — 完整處理器類別
## 代碼範本 / Code Template
```java
package {plugin_package}.messaging;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.PluginMessageEvent;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.ServerConnection;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.slf4j.Logger;
public class ProxyMessagingHandler {
// Channel identifier: "{channel_namespace}:{channel_name}"