# 自定义玩家状态

## 什么是玩家状态？

它们是由 ItemsAdder 添加的自定义属性，你可以使用一个特殊命令添加和读取它们：`/iaplayerstat`

然后你可以使用 **PlaceholderAPI** 在任何地方显示它们或将它们绑定到 HUD。\
我用它来创建口渴和法力值。查看我的[默认配置](https://github.com/search?q=repo%3AItemsAdder%2FDefaultPack+player_stat_name\&type=code)以获取示例。

### 示例：

`/iaplayerstat write LoneDev thirst 6`\
`/iaplayerstat read LoneDev thirst float`

## 保存玩家状态

### 自定义 NBT 文件

将它们保存到由 ItemsAdder 处理的自定义 NBT 文件中，该文件可以稍后轻松删除。\
此文件保存在 `plugins\ItemsAdder\storage\players\stats\` 文件夹中。

```yaml
player_stats:
  save_type: CUSTOM_NBT
```

<figure><img src="/files/6RUxHFiN1X4p9mxxNusY" alt=""><figcaption></figcaption></figure>

### player.dat 文件

将它们保存至原版 `player.dat` 文件。\
如果您想同步服务器，并且已经同步了玩家数据文件，这很有用。

```yaml
player_stats:
  save_type: PLAYER_DAT
```

<figure><img src="/files/YjWKlQObroFYV86Uw2zQ" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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://itemsadder.devs.beer/chinese/cha-jian-shi-yong-fang-fa/custom-playerstats.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.
