ConfigEase 是一个 PlaceholderAPI 扩展,它允许你使用占位符从其他插件读取 YAML 或 JSON 配置文件。
***安装时请将此插件放在 plugins 文件夹中。***
`%___%`
- ``: yamlConfig 或 jsonConfig
- ``: 配置文件所在的 /plugins 目录下的文件夹名称
- ``: 文件名(例如 config.yml 或 data.json)
- ``: 配置文件内部的键路径,使用 . 作为层级分隔符
## YAML 示例
文件:`plugins/Essentials/config.yml`
```
spawn:
world: "world"
location:
x: 100
y: 64
z: 200
welcome_message: "Welcome, player!"
```
### 占位符:
```
%yamlConfig_Essentials_config.yml_spawn.world% → world
%yamlConfig_essentials_config.yml_spawn.location.x% → 100
%yamlConfig_essentials_config.yml_welcome_message% → Welcome, player!
```
## JSON 示例
文件:`plugins/test/data.json`
```
{
"users": {
"1234": {
"name": "Pudding",
"score": 99
}
},
"settings": {
"motd_message": "Welcome!",
"features": ["a", "b", "c"]
}
}
```
### 占位符:
```
%jsonConfig_test_data.json_users.1234.name% → Pudding
%jsonConfig_test_data.json_settings.motd_message% → Welcome!
%jsonConfig_test_data.json_settings.features.1% → b
```
## 配置文件
```
# 默认根目录,用于查找插件配置文件
default_path: "plugins"
# 占位符求值失败时显示的错误消息
messages:
invalid_format: "Invalid Format"
file_not_found: "File Not Found"
no_key: "No Key"
error: "Error"
```