GUI 模板配置
GUI 模板文件位于 plugins/AIOShop/templates/ 目录。
完整配置示例
yaml
# templates/my-template.yml
name: "自定义模板"
description: "我的自定义商店模板"
category: "custom"
size: 54
title: "&2&l%shop_name%"
# 商品展示槽位
item-slots: [10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34]
# 空位置显示
empty:
name: "&7空位"
material: GRAY_STAINED_GLASS_PANE
lore:
- "&7该位置当前没有商品"
# 已下架商品显示
unknown:
name: "&c商品已下架"
material: RED_STAINED_GLASS_PANE
lore:
- "&c该商品信息已失效"
# 商品 Lore 模板
items-lore:
- "%description%"
- "%base_lore%"
- ""
- "%price_display%"
- "%limit_display%"
# 格式化配置
formats:
price:
buy_and_sell: "&7价格: &a买入 %buy_price% %buy_currency_name% &7| &c卖出 %sell_price% %sell_currency_name%"
buy_only: "&7价格: &a买入 %buy_price% %buy_currency_name%"
sell_only: "&7价格: &c卖出 %sell_price% %sell_currency_name%"
buy_with_discount: "&7原价: &m%original_price% %buy_currency_name%&r &7| &6折扣价: &a%buy_price% %buy_currency_name% &e(--%discount_percent%%)"
not_tradeable: "&7价格: &8不可交易"
default: "&7价格: &f未配置"
limit:
limited: "&7限购: &c%current%/%max%"
unlimited: ""
status:
not-available: "&c状态: %cant_purchase_reason%"
# 自定义按钮
custom-items:
close:
name: "&c&l关闭"
material: BARRIER
slots: [49]
action: "CLOSE"
lore:
- "&7点击关闭商店"
border:
name: " "
material: BLACK_STAINED_GLASS_PANE
slots: [0, 1, 2, 3, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 50, 51, 52, 53]
action: "NULL"
info:
name: "&e&l商店信息"
material: BOOK
slots: [4]
action: "NULL"
lore:
- "&7欢迎光临!"槽位布局
6 行箱子界面(54 格)的槽位编号:
0 1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16 17
18 19 20 21 22 23 24 25 26
27 28 29 30 31 32 33 34 35
36 37 38 39 40 41 42 43 44
45 46 47 48 49 50 51 52 53常用布局示例
去边框布局(28 个商品位):
yaml
item-slots: [10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43]紧凑布局(21 个商品位):
yaml
item-slots: [10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34]小型布局(9 个商品位):
yaml
item-slots: [10, 11, 12, 13, 14, 15, 16, 19, 20]按钮操作
| 操作 | 说明 |
|---|---|
CLOSE | 关闭界面 |
NULL | 无操作(装饰用) |
PREVIOUS_PAGE | 上一页 |
NEXT_PAGE | 下一页 |
REFRESH | 刷新商店(随机商店) |
分页模板
yaml
custom-items:
previous:
name: "&a上一页"
material: ARROW
slots: [45]
action: "PREVIOUS_PAGE"
lore:
- "&7点击查看上一页"
# 可配置禁用状态
disabled:
name: "&7上一页"
material: GRAY_DYE
lore:
- "&7已经是第一页了"
next:
name: "&a下一页"
material: ARROW
slots: [53]
action: "NEXT_PAGE"
lore:
- "&7点击查看下一页"
disabled:
name: "&7下一页"
material: GRAY_DYE
lore:
- "&7已经是最后一页了"随机商店刷新按钮
yaml
custom-items:
refresh:
name: "&6&l刷新商店"
material: SUNFLOWER
slots: [4]
action: "REFRESH"
lore:
- "&7消耗 1 点刷新点数"
- "&7获取新的商品"
- ""
- "&7当前刷新点数: &e%refresh_points%"Lore 变量
| 变量 | 说明 |
|---|---|
%description% | 商品描述(来自商店配置) |
%base_lore% | 物品原有 Lore |
%price_display% | 根据 formats.price 格式化的价格 |
%limit_display% | 根据 formats.limit 格式化的限购信息 |
%status_display% | 状态信息(不可购买原因等) |
价格格式变量
| 变量 | 说明 |
|---|---|
%buy_price% | 购买价格 |
%sell_price% | 出售价格 |
%buy_currency_name% | 购买货币名称 |
%sell_currency_name% | 出售货币名称 |
%original_price% | 原价(折扣前) |
%discount_percent% | 折扣百分比 |
限购格式变量
| 变量 | 说明 |
|---|---|
%current% | 当前已购买/出售数量 |
%max% | 最大限制数量 |
标题变量
| 变量 | 说明 |
|---|---|
%shop_name% | 商店名称 |
%page% | 当前页码 |
%total_pages% | 总页数 |
示例:
yaml
title: "&2&l%shop_name% &7- &f第 %page%/%total_pages% 页"