Skip to content

Commit 666e8f1

Browse files
committed
Add economy examples guide
1 parent 75b319b commit 666e8f1

File tree

2 files changed

+199
-0
lines changed

2 files changed

+199
-0
lines changed
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
---
2+
title: 经济配置实战示例
3+
description: MatrixShop 中 Vault、PlayerPoints 和自定义占位符货币的常见配置写法。
4+
---
5+
6+
# 经济配置实战示例
7+
8+
这页只给可以直接照抄的配置,不重复解释概念。
9+
如果你还没看过优先级规则,先看 [经济模块](./economy)
10+
11+
## 示例 1:整服默认使用 Vault
12+
13+
适合最常见的生存服经济配置。
14+
15+
```yml
16+
# Economy/currency.yml
17+
vault:
18+
Mode: vault
19+
Display-Name: "金币"
20+
Symbol: "$"
21+
Decimal: true
22+
```
23+
24+
```yml
25+
# SystemShop/settings.yml
26+
Currency:
27+
Key: vault
28+
```
29+
30+
```yml
31+
# PlayerShop/settings.yml
32+
Currency:
33+
Key: vault
34+
```
35+
36+
```yml
37+
# GlobalMarket/settings.yml
38+
Currency:
39+
Key: vault
40+
```
41+
42+
```yml
43+
# Auction/settings.yml
44+
Options:
45+
Currency:
46+
Key: vault
47+
```
48+
49+
```yml
50+
# Transaction/settings.yml
51+
Options:
52+
Currency:
53+
Money-Key: vault
54+
```
55+
56+
```yml
57+
# ChestShop/settings.yml
58+
Currency:
59+
Key: vault
60+
```
61+
62+
## 示例 2:拍卖使用点券,其余模块仍然使用金币
63+
64+
适合把拍卖做成特殊玩法的服务器。
65+
66+
```yml
67+
# Economy/currency.yml
68+
vault:
69+
Mode: vault
70+
Display-Name: "金币"
71+
Decimal: true
72+
73+
playerpoints:
74+
Mode: playerpoints
75+
Display-Name: "点券"
76+
Decimal: false
77+
```
78+
79+
```yml
80+
# Auction/shops/default.yml
81+
Currency:
82+
Key: playerpoints
83+
```
84+
85+
说明:
86+
87+
- `Auction/shops/default.yml` 已经覆盖了商店级货币
88+
- 即使 `Auction/settings.yml` 里写的是 `vault`
89+
- 默认拍卖入口依然会优先使用 `playerpoints`
90+
91+
## 示例 3:SystemShop 中只有个别商品使用点券
92+
93+
适合大部分商品卖金币,个别稀有商品卖点券。
94+
95+
```yml
96+
# SystemShop/settings.yml
97+
Currency:
98+
Key: vault
99+
```
100+
101+
```yml
102+
# SystemShop/shops/weapon.yml
103+
Currency:
104+
Key: vault
105+
106+
goods:
107+
iron_sword:
108+
material: 'IRON_SWORD'
109+
amount: 1
110+
price: 120
111+
buy-max: 16
112+
name: '&f铁剑'
113+
114+
diamond_sword:
115+
material: 'DIAMOND_SWORD'
116+
amount: 1
117+
price: 420
118+
currency: playerpoints
119+
buy-max: 8
120+
name: '&b钻石剑'
121+
```
122+
123+
最终效果:
124+
125+
- `iron_sword` 使用 `vault`
126+
- `diamond_sword` 使用 `playerpoints`
127+
128+
## 示例 4:Transaction 使用点券做金钱报价
129+
130+
适合不想让交易界面直接操作服务器金币的玩法服。
131+
132+
```yml
133+
# Transaction/settings.yml
134+
Options:
135+
Currency:
136+
Money-Key: playerpoints
137+
Trade:
138+
Allow-Items: true
139+
Allow-Money: true
140+
Allow-Exp: false
141+
```
142+
143+
```yml
144+
# Transaction/shops/default.yml
145+
Currency:
146+
Key: playerpoints
147+
```
148+
149+
## 示例 5:自定义 Placeholder 货币
150+
151+
适合已有自定义积分系统,并且能通过命令增减积分。
152+
153+
```yml
154+
# Economy/currency.yml
155+
custom_points:
156+
Mode: "%custom_points%"
157+
Display-Name: "活动积分"
158+
Decimal: false
159+
Actions:
160+
Take:
161+
- "console: custompoints take {player} {amount}"
162+
Give:
163+
- "console: custompoints give {player} {amount}"
164+
Deny:
165+
- "tell:&c活动积分不足,需要 &e{need} &c,当前为 &e{balance}"
166+
```
167+
168+
然后在模块、商店或商品里引用:
169+
170+
```yml
171+
Currency:
172+
Key: custom_points
173+
```
174+
175+
## 示例 6:不写任何货币配置
176+
177+
当前版本会自动回退到:
178+
179+
```yml
180+
vault
181+
```
182+
183+
前提是:
184+
185+
- 你已安装 Vault
186+
- 且有可用经济提供者
187+
188+
如果没有可用 Vault,相关模块会在结算时直接提示货币不可用。
189+
190+
## 推荐排查顺序
191+
192+
当你怀疑货币没生效时,建议按这个顺序看:
193+
194+
1. `Economy/currency.yml` 中对应 key 是否存在
195+
2. 当前模块 `settings.yml` 是否写了默认货币
196+
3. 当前 `shops/*.yml` 是否覆盖了 `Currency.Key`
197+
4. `SystemShop` 商品是否写了单独的 `currency`
198+
5. `/matrixshopadmin status` 中的经济系统摘要是否正常

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const sidebars: SidebarsConfig = {
4747
'matrixshop/quick-start',
4848
'matrixshop/configuration-structure',
4949
'matrixshop/economy',
50+
'matrixshop/economy-examples',
5051
'matrixshop/commands-and-permissions',
5152
'matrixshop/database-and-storage',
5253
'matrixshop/modules-overview',

0 commit comments

Comments
 (0)