> For the complete documentation index, see [llms.txt](https://helpchat.wiki.complexstudio.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://helpchat.wiki.complexstudio.net/helpchat-zhong-wen-wei-ji/deluxemenus/xuan-xiang-pei-zhi/tiao-jian.md).

# 条件

### 基本结构

```yaml
# 其他可用的条件类型:
# open_requirement: 
# view_requirement:
# left_click_requirement:
# right_click_requirement:
# shift_left_click_requirement:
# shift_right_click_requirement:
click_requirement:
  # 至少需要达到的子条件数 这一选项是完全_可选_的.
  # 这意味着若您不需要此选项,请直接删除它.
  minimum_requirements: 1
  # 此项依赖于上方的 至少需要达到的子条件数 选项
  stop_at_success: true
  requirements:
    # 你可以在此定义多个子条件
    # 每个子条件必须有一个独一无二的命名
    requirement_name:
      type: TYPE
      # 若用户达到了该子条件,会执行下述行为
      success_commands:
      - "[ACTIONTYPE] ACTION"
      - "[ACTIONTYPE] ACTION"
      # 若用户未能达到该子条件,则会执行下述行为
      deny_commands:
      - "[ACTIONTYPE] ACTION"
      - "[ACTIONTYPE] ACTION"
      # 仅仅只有在启用并设定上方的
      # 至少需要达到的子条件数 选项 时才有效
      # 同样地,那一选项也仅仅只适用于设定为可选的子选项
      optional: true
  # 若玩家未能符合所有子选项或所要求的最低选项数
  # 即最后执行下述行为
  deny_commands:
    - "[ACTIONTYPE] ACTION"
    - "[ACTIONTYPE] ACTION"
```

### 条件

| 类型       | **介绍**      |
| -------- | ----------- |
| 打开菜单的条件  | 定义打开菜单的条件   |
| 看到物品的条件  | 定义能看到该物品的条件 |
| 单击或右击的条件 | 定义单击或右击的条件  |

* 您同样可以在撰写条件中使用PlaceholderAPI所提供的变量(下文称`PAPI变量`)

### 条件类型

#### 拥有某一权限 (`has perimission`)

```yaml
type: has permission
permission: '在这里填写权限'
```

检测玩家是否`拥有`某一权限

> 如果您想检测玩家是否`没有`某一权限，您可以在`has permission`前加上一个感叹号(`!`) 就像这样 `type: !has permission`
>
> 但请注意,必须是英文输入模式下的感叹号. 下文中所有以`has`/`is`开头等的条件类型均适用这一技巧

#### 拥有一定数量的金钱

```yaml
type: has money
amount: #
```

检测玩家是否`拥有`一定数量的金钱

* 请注意,上文所赘述的金钱即与**Vault**挂钩的经济系统的余额称呼,

  在不同的服务器对该**余额**可能有不同的称呼和权重定义

> 同样,您可以在`has money`前加上感叹号(**!**),以表示反义(即检测玩家是否`没有`一定数量的金钱) 就像这样 `type: !has money`
>
> 如果您想将一个PAPI变量用作阈值, 那么请将 `amount: #` 替换为 `placeholder: 变量` 即
>
> ```yaml
> type: has money
> placeholder: 变量
> ```

#### 拥有一定数量的某一物品

```yaml
type: has item
material: "TEXT"
#物品的英文ID,例如CLOCK
data: #
#物品的子ID,例如白色羊毛即0,
#若该物品没有子ID,请删去此参数
amount: #
#物品的数量
name: "TEXT"
#该物品的名字,可以使用颜色/样式代码
#也可以使用PAPI变量
#若物品未被重命名,请忽略该参数
lore:
  - "TEXT"
#该物品的Lore,可以填写的字符同上
#若该物品没有Lore请删去此参数
```

必填的物品参数:

* `material`
* `amount`

> 若该物品有多个子ID,但您仍然删去了data参数 则将会默认视为子ID为0

检测玩家是否拥有一定数量的某一物品

> 若想在name和lore中使用颜色亦或者样式代码,请使用`§`而非`&`

#### 拥有某一属性

```
type: has meta
key: "TEXT"
# 指定键
meta_type: <STRING, BOOLEAN, DOUBLE, LONG, INTEGER>
# 属性类型
value: EXPECTED VALUE
# 值
```

必填的物品参数:

* `key`
* `meta_type`
* `value`

检查玩家是否有特定关键字的属性

如果 `meta_type` 是数字类型 (`DOUBLE, LONG, INTEGER`) 则会检查玩家的 `value` 值是否大于或等于该值

同样,您可以在`has meta`前加上感叹号(`!`)，以表示反义就像这样 `type: !has meta`

> 请注意,此条件为DeluxeMenus较新版本所更新的新属性

#### 判断是否在某一点附近

```
type: is near
location: "WORLDNAME,X,Y,Z"
# 位置 (世界名,X,Y,Z)
# 译者提醒: 世界名请填写原始名称,勿填写某个世界的别称
distance: #
# 玩家需在以该距离为半径的球体内方判定为true
```

必填的物品参数:

* `location`
* `distance`

判断玩家是否在以定义的 `location` 点为球心，以设定的 `distance` 距离为半径的球体内。

同样,您可以在`is near`前加上感叹号(`!`)，以表示反义。就像这样 `type: !is near`

#### JavaScript

```yaml
type: javascript
# 类型
expression: 'EXPRESSION'
# 表达式
```

例子:

```yaml
type: javascript
# 类型
expression: '%vault_eco_balance% >= 100'
# 表达式 判定玩家经济系统余额是否大于 100
```

使用 JavaScript , 必须整体返回 `true` 或者 `false`

#### 字符串比较

```yaml
type: string equals
#类型
input: 'TEXT'
# 输入字符串
output: 'TEXT'
# 输出字符串
# 比较输入字符串是否相等
```

例子:

```yaml
type: string equals
# 类型
input: '%server_name%'
# 输入字符串
output: 'HelpChat'
# 输出字符串
```

比较 输入值 `input` 和 输出值 `output`

同样,您可以在`string equals`前加上感叹号(`!`)，以表示反义。 就像这样 `type: !string equals`

#### 忽略大小写的字符串比较

```yaml
type: string equals ignorecase
# 类型
input: 'TEXT'
# 输入字符串
output: 'TEXT'
# 输出字符串
# 比较输入字符串是否相等(忽略大小写)
```

例子:

```yaml
type: string equals ignorecase
# 类型
input: '%server_name%'
# 输入字符串
output: 'HelpChat'
# 输出字符串
```

比较 输入值 `input` 和 输出值 `output`

同样,您可以在`string equals ignorecase`前加上感叹号(`!`)，以表示反义。 就像这样 `type: !string equals ignorecase`

#### 是否包含字符串

```yaml
type: string contains
# 类型
input: 'TEXT'
# 输入字符串
output: 'TEXT'
# 输出字符串
#比较输入字符串是否包含输出字符串
```

例子:

```yaml
type: string contains
# 类型
input: '%server_name%'
# 输入字符串
output: 'HelpChat'
# 输出字符串
```

比较 输入值 `input` 和 输出值 `output`

同样,您可以在`string contains`前加上感叹号(`!`)，以表示反义。 就像这样 `type: !string contains`

#### 正则表达式

```
type: regex matches
# 类型
input: 'TEXT'
# 输入字符串
regex: 'EXPRESSION'
# 正则表达式
```

比较 输入值 `input` 是否匹配 `regex` 中的正则表达式:

访问 [这个网站](https://regexr.com/) 轻松创建正则表达式

同样,您可以在`regex matches`前加上感叹号(`!`)，以表示反义。 就像这样 `type: !regex matches`

#### 比较

```yaml
type: regex matches
# 类型
input: #
# 输入量
regex: #
# 输出量
```

比较 输入值 `input` 和 `output` 输出量

**可用选项**

| 类型 | 介绍                      |
| -- | ----------------------- |
| == | `input` 是否等于 `output`   |
| >= | `input` 是否大于等于 `output` |
| <= | `input` 是否小于等于 `output` |
| != | `input` 是否不等于 `output`  |
| >  | `input` 是否大于 `output`   |
| <  | `input` 是否小于 `output`   |

### 例子

#### 打开条件

```yaml
open_requirement:
  requirements:
  # 条件
    example_1:
    # 节点
      type: has permission
      #类型
      permission: open.menu.one
      #权限
  deny_commands:
    - "[message] &cYou don't have the permission."
    #执行动作
```

#### 查看条件

```yaml
view_requirement:
  requirements:
  # 条件
    example_2:
    # 节点
      type: string equals
      #类型
      input: "%player_is_op%"
      #输入量
      output: "yes"
      #输出量
```

#### 左/右键条件

```yaml
# left_click_requirement: or
right_click_requirement:
  requirements:
    example_3:
    # 节点
      type: has money
      # 类型
      amount: 100
      # 数量
  deny_commands:
    - "[message] &7You don't have enough money."
    # 执行动作
```

翻译仅供参考，若存在异议或建议请发送邮件至 `azurehanchen@complexstudio.net`


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpchat.wiki.complexstudio.net/helpchat-zhong-wen-wei-ji/deluxemenus/xuan-xiang-pei-zhi/tiao-jian.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.
