> For the complete documentation index, see [llms.txt](https://docs.myarc.icu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.myarc.icu/cai-dan-shi-li/integration-menu.md).

# 插件联动菜单示例

ArcMenu 可以直接调用服务器上其他插件提供的命令、占位符、自定义物品与应用界面。下面我们制作一个“玩家服务”菜单 `services.yml`，把常用的返回出生点命令封装成菜单按钮，并演示如何逐步扩展更多插件联动功能。

## 基础示例：`services.yml`

在 `plugins/ArcMenu/menus/services.yml` 中创建以下文件：

```yaml
schema-version: 1
id: services
canvas:
  width: 320
  height: 180
  pixels-per-block: 42.7
  distance: 3
frontend:
  service-background:
    type: rectangle
    width: 180
    height: 100
    color: '#182031'
  service-title:
    type: text
    content: '&f玩家服务'
    size: 5
    offset: {y: 32, z: 1}
  player-label:
    type: text
    content: '&7%player_name%'
    size: 3
    offset: {y: 15, z: 1}
  spawn-button:
    type: rectangle
    width: 100
    height: 20
    color: '#365E91'
    offset: {y: -8, z: 1}
  spawn-label:
    type: text
    content: '&f回到出生点'
    size: 3
    offset: {y: -8, z: 2}
  close-label:
    type: text
    content: '&7关闭'
    size: 3
    offset: {y: -34, z: 1}
backend:
  spawn-area:
    x: 0
    y: -8
    width: 100
    height: 20
    actions:
      right: 'player: spawn'
  close-area:
    x: 0
    y: -34
    width: 60
    height: 16
    actions:
      right: close
```

保存文件后执行 `/arcmenu reload`，再使用 `/arcmenu open services` 打开菜单。当玩家右键点击“回到出生点”时，`player: spawn` 会以该玩家自身的身份和权限执行服务器上的 `/spawn` 命令（无需在命令前写斜杠 `/`）。当命令触发玩家跨位置传送时，ArcMenu 会自动关闭当前菜单并释放视角。

## 进阶联动方式

在此基础上，你可以将服务器上的经济、商店、任务、自定义材质等插件整合进同一个界面：

### 1. 玩家命令与控制台命令

* **`player: <命令>`**（或 `command: <命令>`）：以点击菜单的玩家身份执行命令，适合打开领地、公会、任务、传送点等原本就开放给玩家的指令。
* **`console: <命令>`**：以服务器控制台最高权限执行命令，适合发放奖励、修改权限或调用只允许后台运行的管理指令。命令中可以自由混用占位符：

```yaml
actions:
  right:
    - 'console: minecraft:give %player_name% minecraft:diamond 1'
    - 'tell: &a已为你发放一颗钻石。'
```

### 2. 结合经济条件与 PlaceholderAPI

安装 PlaceholderAPI、Vault 或 PlayerPoints 后，不仅可以在前端 `text` 节点中实时展示 `%vault_eco_balance%`、`%playerpoints_points%`，还可以在后端区域或条件动作中直接判断余额、权限并执行购买：

```yaml
backend:
  vip-kit-area:
    x: 0
    y: -8
    width: 100
    height: 20
    condition: 'perm myserver.vip && money >= 100'
    actions:
      right:
        - 'take-money: 100'
        - 'console: kit give %player_name% vip'
        - 'tell: &a已花费 100 金币领取 VIP 礼包！'
    deny:
      - 'tell: &c你需要拥有 VIP 资格且余额不少于 100 金币。'
```

### 3. 展示玩家头颅与自定义模型物品

在前端添加 `type: item` 元素时，除了原版材质名，还可以直接使用动态玩家头颅或 CraftEngine、Nexo、ItemsAdder 的自定义物品模型：

```yaml
frontend:
  avatar-icon:
    type: item
    material: '<head:%player_name%>'
    offset: {x: -60, y: 20, z: 2}
    scale: {x: 12, y: 12, z: 1}
  custom-gem:
    type: item
    material: 'craftengine:my_pack:gem' # 也支持 nexo:gem 或 ia:my_pack:gem
    offset: {x: 60, y: 20, z: 2}
    scale: {x: 12, y: 12, z: 1}
```

### 4. 打开附属插件的托管应用

如果服务器上安装了接入 [ArcMenu 开发者应用 API](/gong-neng-pei-zhi/application-api.md) 的附属插件，只需在按钮动作中使用 `open-app: 命名空间:应用ID [可选参数]`，就能在保持当前屏幕位置不变的情况下，平滑切换到该插件的专属交互界面：

```yaml
actions:
  right:
    - 'open-app: myplugin:shop featured'
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.myarc.icu/cai-dan-shi-li/integration-menu.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
