Skip to content

Commit f40ac63

Browse files
committed
Add documents
1 parent 4e77af4 commit f40ac63

File tree

2 files changed

+530
-2
lines changed

2 files changed

+530
-2
lines changed

README.cn.md

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
# PayTp 模组使用文档
2+
3+
See the English document [here](./README.md).
4+
5+
---
6+
7+
## 简介
8+
9+
**PayTp** 是一款轻量但功能齐全的“付费传送”模组,让玩家在服务器或单人世界中使用物品作为货币进行传送。
10+
支持以下特性:
11+
12+
- 玩家间传送请求系统
13+
- 家(Home)与回溯(Back)功能
14+
- 自定义传送价格算法
15+
- 末影箱 / 潜影盒 支付支持
16+
- Cloth Config 图形化配置界面(客户端)
17+
- 可作为 **纯服务器端模组** 使用(Server-Side Only)
18+
19+
---
20+
21+
## 可用命令总览
22+
23+
| 命令 | 功能 |
24+
|-------------------------|------------|
25+
| `/ptp <玩家>` | 请求传送到指定玩家。 |
26+
| `/ptp <x> <y> <z>` | 传送到指定坐标。 |
27+
| `/ptp <维度> <x> <y> <z>` | 传送到指定维度坐标。 |
28+
| `/ptpback` | 回到上一次传送点。 |
29+
| `/ptphome` | 回家。 |
30+
| `/ptpsethome` | 设置家。 |
31+
| `/ptpaccept` | 接受传送请求。 |
32+
| `/ptpdeny` | 拒绝传送请求。 |
33+
| `/ptpcancel` | 取消传送请求。 |
34+
35+
---
36+
37+
## 配置文件结构
38+
39+
### 配置文件路径:
40+
41+
```
42+
~/config/paytp.json
43+
```
44+
45+
### 默认配置:
46+
47+
```json
48+
{
49+
"general": {
50+
"language": "en_us",
51+
"mainCommand": "ptp",
52+
"crossDimMultiplier": 1.5
53+
},
54+
"request": {
55+
"requestCommand": {
56+
"acceptCommand": "ptpaccept",
57+
"denyCommand": "ptpdeny",
58+
"cancelCommand": "ptpcancel"
59+
},
60+
"expireTime": 10
61+
},
62+
"home": {
63+
"homeCommand": "ptphome",
64+
"homeMultiplier": 0.5
65+
},
66+
"back": {
67+
"backCommand": "ptpback",
68+
"maxBackStack": 10,
69+
"backMultiplier": 0.8
70+
},
71+
"price": {
72+
"currencyItem": "minecraft:diamond",
73+
"parameter": {
74+
"minPrice": 1,
75+
"maxPrice": 64,
76+
"baseRadius": 10.0,
77+
"rate": 0.01
78+
}
79+
},
80+
"setting": {
81+
"effect": {
82+
"particleEffect": true
83+
},
84+
"flag": {
85+
"allowEnderChest": true,
86+
"prioritizeEnderChest": true,
87+
"allowShulkerBox": false,
88+
"prioritizeShulkerBox": false
89+
}
90+
}
91+
}
92+
```
93+
94+
---
95+
96+
## 配置部分详解
97+
98+
### 通用设置
99+
100+
| 字段名 | 类型 | 说明 |
101+
|----------------------|----------|----------------------------------------------|
102+
| `language` | `string` | 语言文件(如 `zh_cn`, `en_us`, `zh_tw`),影响提示与帮助信息。 |
103+
| `mainCommand` | `string` | 主命令名,例如 `/ptp`|
104+
| `crossDimMultiplier` | `double` | 跨维度传送的价格倍率,例如 1.5 表示多付 1.5 倍价格。 |
105+
106+
---
107+
108+
### 传送请求系统
109+
110+
#### 请求命令
111+
112+
| 字段名 | 类型 | 说明 |
113+
|-----------------|----------|----------------------------|
114+
| `acceptCommand` | `string` | 接受请求的命令(默认 `/ptpaccept`|
115+
| `denyCommand` | `string` | 拒绝请求的命令(默认 `/ptpdeny`|
116+
| `cancelCommand` | `string` | 取消自己发出的请求(默认 `/ptpcancel`|
117+
118+
#### 配置
119+
120+
| 字段名 | 类型 | 说明 |
121+
|--------------|-------|-------------|
122+
| `expireTime` | `int` | 传送请求超时时间(秒) |
123+
124+
---
125+
126+
### 家系统
127+
128+
| 字段名 | 类型 | 说明 |
129+
|------------------|----------|----------------------|
130+
| `homeCommand` | `string` | 回家命令(默认 `/ptphome`|
131+
| `homeMultiplier` | `double` | 回家传送的倍率,例如 0.5 表示半价。 |
132+
133+
---
134+
135+
### 回溯系统
136+
137+
| 字段名 | 类型 | 说明 |
138+
|------------------|----------|---------------------------|
139+
| `backCommand` | `string` | 回到上一个位置的命令(默认 `/ptpback`|
140+
| `maxBackStack` | `int` | 最多可保存的历史位置数量。 |
141+
| `backMultiplier` | `double` | 回溯倍率,例如 0.8 表示 8 折价格。 |
142+
143+
---
144+
145+
146+
### 花费计算设置
147+
148+
#### 货币
149+
150+
| 字段名 | 类型 | 说明 |
151+
|----------------|----------|------------------------------------|
152+
| `currencyItem` | `string` | 支付货币的物品 ID,例如 `minecraft:diamond`|
153+
154+
#### 金额参数
155+
156+
| 字段名 | 类型 | 说明 |
157+
|--------------|----------|----------------|
158+
| `minPrice` | `int` | 最低价格。 |
159+
| `maxPrice` | `int` | 单次传送最高上限。 |
160+
| `baseRadius` | `double` | 在此半径内传送为最低价。 |
161+
| `rate` | `double` | 超出基础半径后的距离增长率。 |
162+
163+
---
164+
165+
### 设置项
166+
167+
#### 效果
168+
169+
| 字段名 | 类型 | 说明 |
170+
|------------------|-----------|---------------|
171+
| `particleEffect` | `boolean` | 是否启用传送时的粒子效果。 |
172+
173+
#### 特性开关
174+
175+
| 字段名 | 类型 | 说明 |
176+
|------------------------|-----------|----------------|
177+
| `allowEnderChest` | `boolean` | 是否允许使用末影箱中的货币。 |
178+
| `prioritizeEnderChest` | `boolean` | 是否优先从末影箱扣款。 |
179+
| `allowShulkerBox` | `boolean` | 是否允许使用潜影盒中的货币。 |
180+
| `prioritizeShulkerBox` | `boolean` | 是否优先从潜影盒扣款。 |
181+
182+
---
183+
184+
## 价格计算公式
185+
186+
### 计算逻辑说明
187+
188+
1. **计算距离**
189+
190+
- 同一维度:
191+
- 直接使用欧氏距离。
192+
- 维度间传送:
193+
- 从主世界 → 下界:乘以 8 倍。
194+
- 从下界 → 主世界:乘以 0.125 倍。
195+
- 进入/离开末地:使用到原点 `(0,0,0)` 的距离。
196+
- 其他维度:
197+
- 暂时使用裸欧氏距离计算,如果你要魔改源码,可以在`PayTpCalculator`中的`calculatePrice`进行设置。
198+
199+
2. **计算公式**
200+
201+
```
202+
distanceBeyondBase = max(0, distance - baseRadius)
203+
rawPrice = minPrice + distanceBeyondBase * increaseRate
204+
totalPrice = rawPrice * externalMultiplier
205+
```
206+
207+
3. **最终价格**
208+
209+
```
210+
price = min(totalPrice, maxPrice)
211+
```
212+
213+
---
214+
215+
### 价格计算示例
216+
217+
假设为默认`price`配置:
218+
219+
```json
220+
{
221+
"minPrice": 1,
222+
"maxPrice": 64,
223+
"baseRadius": 10.0,
224+
"rate": 0.01,
225+
"crossDimMultiplier": 1.5
226+
}
227+
```
228+
229+
- 玩家 A 传送至玩家 B(同一世界,距离 200 格):
230+
```
231+
超出距离 = 200 - 10 = 190
232+
价格 = (1 + 190 × 0.01) × 1.0 = 2.9 → 四舍五入为 3
233+
```
234+
- 跨维度传送:
235+
```
236+
价格 = 3 × 1.5 = 4.5 → 四舍五入为 5
237+
```
238+
- 价格上限自动封顶为 64。
239+
240+
---
241+
242+
## Cloth Config 支持
243+
244+
如果安装了 **Cloth Config API**,可以在游戏内通过 Mod Menu 图形界面直接调整所有配置项。(需重启世界)。
245+
246+
---
247+
248+
## 兼容性与部署
249+
250+
| 类型 | 支持 |
251+
|-----------------------|-----------------------|
252+
| Fabric Loader ||
253+
| Server Only ||
254+
| 客户端 UI (Cloth Config) ||
255+
| 多语言支持 | zh_cn / zh_tw / en_us |
256+
| Minecraft 版本 | 1.21+ |
257+
258+
---
259+
260+
## 致谢
261+
262+
本模组灵感来自早期经济型传送插件,请求逻辑参考TPA模组,使用 Fabric API 编写,兼容原版存档。
263+
欢迎在 GitHub 上提交 Issue 或 PR 改进配置逻辑与算法。
264+

0 commit comments

Comments
 (0)