> 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/server-menu.md).

# 服务器导航菜单示例

下面我们从零搭建一套包含两个页面的服务器导航菜单：主页面 `server-hub` 与详情页 `server-info`。玩家在主页面点击“服务器信息”会切换到详情页，在详情页点击“返回”会回到主页面，点击“帮助”则会在聊天栏收到提示消息。

将以下两个文件保存在 `plugins/ArcMenu/menus/` 目录下即可。本示例仅使用原生文本与矩形元素，无需额外图片资源包即可直接显示。

## 主导航页：`server-hub.yml`

在 `plugins/ArcMenu/menus/server-hub.yml` 中写入以下配置：

```yaml
schema-version: 1
id: server-hub
permission: arcmenu.use
canvas:
  width: 320
  height: 180
  pixels-per-block: 42.7
  distance: 3
frontend:
  hub-background:
    type: rectangle
    width: 200
    height: 110
    color: '#182031'
  hub-title:
    type: text
    content: '&f服务器导航'
    size: 5
    offset: {x: 0, y: 40, z: 1}
  information-button:
    type: rectangle
    width: 70
    height: 20
    color: '#365E91'
    offset: {x: -45, y: 0, z: 1}
  information-label:
    type: text
    content: '&f服务器信息'
    size: 3
    offset: {x: -45, y: 0, z: 2}
  help-button:
    type: rectangle
    width: 70
    height: 20
    color: '#365E91'
    offset: {x: 45, y: 0, z: 1}
  help-label:
    type: text
    content: '&f帮助'
    size: 3
    offset: {x: 45, y: 0, z: 2}
  close-label:
    type: text
    content: '&7关闭'
    size: 3
    offset: {x: 0, y: -35, z: 1}
backend:
  information-area:
    x: -45
    y: 0
    width: 70
    height: 20
    actions:
      right: 'open: server-info'
  help-area:
    x: 45
    y: 0
    width: 70
    height: 20
    actions:
      right: 'tell: &e需要帮助时，可以联系服务器管理员。'
  close-area:
    x: 0
    y: -35
    width: 50
    height: 16
    actions:
      right: close
```

## 服务器信息页：`server-info.yml`

在 `plugins/ArcMenu/menus/server-info.yml` 中写入以下配置：

```yaml
schema-version: 1
id: server-info
permission: arcmenu.use
canvas:
  width: 320
  height: 180
  pixels-per-block: 42.7
  distance: 3
frontend:
  information-background:
    type: rectangle
    width: 200
    height: 110
    color: '#182031'
  information-title:
    type: text
    content: '&f服务器信息'
    size: 5
    offset: {x: 0, y: 40, z: 1}
  player-label:
    type: text
    content: '&7玩家：&f%player_name%'
    size: 3
    offset: {x: 0, y: 10, z: 1}
  rules-label:
    type: text
    content: '&7欢迎在这里开始你的冒险。'
    size: 3
    offset: {x: 0, y: -10, z: 1}
  back-button:
    type: rectangle
    width: 70
    height: 18
    color: '#365E91'
    offset: {x: 0, y: -35, z: 1}
  back-label:
    type: text
    content: '&f返回'
    size: 3
    offset: {x: 0, y: -35, z: 2}
backend:
  back-area:
    x: 0
    y: -35
    width: 70
    height: 18
    actions:
      right: back
```

## 结构与配置要点说明

* **画布与前后层级**：`canvas` 定义了 `320 × 180` 的逻辑网格，`distance: 3` 为设计基准距离（菜单在世界中的实际摆放距离由 `offset.yml` 控制，默认保持一致的视觉大小）。前端元素通过 `offset.z` 控制前后遮挡顺序：背景板在 `z: 0`，按钮底板在 `z: 1`，按钮文字在 `z: 2`，这样文字始终清晰地浮在按钮上方。
* **前后端坐标对齐**：例如“服务器信息”按钮的前端矩形 `information-button` 与后端交互区域 `information-area` 都位于 `x: -45, y: 0`，且宽高均为 `70 × 20`，确保玩家看到的按钮范围与实际可点击区域完全重合。
* **页面跳转与返回栈**：`open: server-info` 会将当前菜单压入返回历史并切换到信息页；信息页中的 `back` 动作则会从历史栈中弹出并回到 `server-hub`。如果玩家直接通过命令打开 `server-info`，此时没有上一页历史，点击 `back` 会直接关闭菜单。
* **点击触发方式**：示例中将动作配置在 `actions.right` 下，即右键触发；如果你希望左键和右键都能触发，可以将 `right:` 改为 `all:`，或者直接把动作写在 `actions: 'open: server-info'`。

## 加载与设为默认主菜单

保存两个文件后，执行 `/arcmenu reload` 加载配置，随后输入 `/arcmenu open server-hub` 即可打开导航界面。要打开该菜单，玩家需要同时拥有默认的 `arcmenu.use` 权限以及菜单中配置的 `permission` 权限。

如果你希望玩家在游戏内按下 Shift+F 时直接打开这个导航页，可以在 `server-hub.yml` 顶层加上 `main-menu: true`（同时将原本设为 `main-menu: true` 的菜单改为 `false`），或者在顶层添加快捷命令 `open-commands: [hub, menu]` 让玩家直接输入 `/hub` 打开。


---

# 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/server-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.
