- 积分
- 21417
- 帖子
- 主题
- 精华
贡献- 份
爱心- 心
- 钻石
- 颗
- 人气
- 点
- 下界之星
- 枚
- 最后登录
- 1970-1-1
- 注册时间
- 2016-8-31
| 5#
楼主 |
发表于 2022-9-24 22:06:46
|
只看该作者 本帖最后由 名副其实 于 2022-9-24 22:17 编辑 GUI 教程
With my plugin you can fully modify the Codex inventory, so it is possible you'll find this section a little bit complicated to understand! Here I will show you an example with a single category. 在我的插件中,你可以完全自定义插件的 GUI 显示内容,但这会略微复杂一些!接下来我将为你展示一个带有一个分类的简单示例菜单。
- Inventories:
- main:
- slots: 45
- title: '&4Codex &7» &8All Categories'
- '21':
- type: history
- item: BOOK
- name: '&7Category: %name%'
- lore:
- - '&eIn your adventures you''ll find some'
- - '&einteresting knowledge.'
- - ''
- - '&7Unlocked: %unlocked% &8[%progress_bar%&8] &8(&7%percentage%&8)'
- open_inventory: history_discoveries
- history_discoveries:
- slots: 45
- title: '&4Codex &7» &8History'
- '11':
- type: history;1
- item: PAPER
- name: '&6Discovery: %name%'
- lore:
- - '%lore%'
- '39':
- skull_data: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzdhZWU5YTc1YmYwZGY3ODk3MTgzMDE1Y2NhMGIyYTdkNzU1YzYzMzg4ZmYwMTc1MmQ1ZjQ0MTlmYzY0NSJ9fX0=
- name: '&7Go Back'
- open_inventory: main
- 0;8;36;44:
- item: BLUE_STAINED_GLASS_PANE
- name: ' '
- 1;7;9;17;27;35;37;43:
- item: BLACK_STAINED_GLASS_PANE
- name: ' '
复制代码You will always need to maintain[注1] the "main" path, which represents the main inventory when using the /codex command. Here you can define different items by setting the slot number on the same section name as shown in the config. 你总是会需要修改 "main" 分支下的大部分内容,这些代表着这个插件显示的主GUI内容,也就是输入 /codex 命令时打开的GUI所包含的内容。在这里你可以通过设置内容相同部分的槽位序号来决定它们在GUI中实际显示的物品样式。
If an item represents a Discovery category you need to add the type option and write the category name (the name of the file). This will allows you to add variables such as: %name% (The name of the category) %unlocked% (Total of unlocked discoveries from this category) %percentage% (Percentage of completition of this category) %progress_bar% (Progress bar showing the completition of this category) 如果一个物品代表一个图鉴的分类,那么你就需要为其设置种类参数,以及定义此分类的名称(这一部分在文件名上修改即可)。 这将会允许你使用例如下面一系列的内建变量: %name% 此分类的名称 %unlocked% 剩余未解锁物品数量 %percentage% 此分类图鉴完成度百分比 %progress_bar% 此分类图鉴完成度进度条
You can add the open_inventory option to open another created inventory when the player clicks on the item. In this case, in the main inventory there is an item in slot 21 which will open the history_discoveries inventory. In this inventory there is an item on slot 39 to go back to the main inventory. 你可以添加 open_inventory 选项以在玩家点击时打开另一个已经存在的 GUI 菜单。那么,在主菜单中将会有一个位于 21 号格子的物品,点击这个物品将会打开 history_discovery 菜单。而在这个菜单中又会有一个在 39 号格子的物品允许玩家在点击后返回主菜单。
If you want an item to represent[注2] a Discovery instead of a Category you need to add the same type option but this time adding a ; followed with the name of the discovery. This wills allows you to add variables such as: %name% (The name of the discovery) %lore% (The lore of the discovery) 若你想要一个物品代表一个可发现物图鉴而不是一个图鉴里的分类,你需要在 type 选项中添加参数,这次你需要在这个分类名称后加上 ; (英文分号),然后是这个图鉴的名字。这会允许你使用一些内建变量: %name% (此图鉴的名称)%lore% (此图鉴的描述)
Here are two images showing this example ingame: 这是两张示例配置在游戏中的显示效果:
![]()
![]()
[注3]
GUI 菜单选项 slots: 45Number of slots for this inventory. Use one of these numbers: 9, 18, 27, 36, 45, 54 打开此菜单的按钮所在的位置。请使用下列数字: 9, 18, 27, 36, 45, 54
title: "&4Codex &7» &8All Categories" 此菜单的名称。
3 21 26;27;28Use a number on this section to represent the slot of an item in the inventory. You can also use multiple slots on the same section for creating the same item on different positions. 在这个位置使用一个数字来代表一个物品在这个菜单中的格子位置。你也可以在同一区域下使用多个格子来达到多个位置显示同一物品的效果。
物品选项
type: regions type: regions;1If this item represents a Codex category or discovery you need to use this option. For Codex category use: type: category_name For Codex discovery use: type: category_name;discovery 如果此物品代表一个图鉴的分类或一个新的图鉴,那么你就会用到这个格式。 图鉴分类使用下列参数: type: 分类名称 单独图鉴使用下列参数: type: 分类名称;图鉴名称
item: BOOK 物品的样式。物品名称参考此处: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html (最新版本) https://github.com/Attano/Spigot ... ukkit/Material.java (1.8 版本)
name: "&7Category: %name%"Name of the item. You can use the %name% variable to show the name of this category OR discovery. You can use PlaceholderAPI variables. 物品的名称。你可以使用内建变量 %name% 来显示这个分类或独立图鉴的名称。
lore: -"&eIn your adventures you'll find" -"&esome interesting knowledge." -"" -"&7Unlocked: %unlocked% &8(&7%percentage%&8)"Lore of the item. You can use the %unlocked% and %percentage% variables. You can use PlaceholderAPI variables. 物品的描述。你可以在这里使用内建变量 %unlocked% 和 %percentage%。你也可以使用 PlaceholderAPI 变量。
custom_model_data: 1Custom model data of the item if you need to add it. 物品的自定义模型数据值。若想要添加可在此自定义。
open_inventory: regions_discoveriesYou can add this option if you want to open another inventory when clicking on this item.
If you want to close the whole inventory, use: open_inventory: close 如果你想要在点击这个物品时打开另一个菜单,你可以添加这个可选选项。 若你需要关闭这个菜单,那么需要使用这个格式: open_inventory: close
skull_data: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7In(...)If you want to place a player head with texture as an item, add this option with its corresponding skull texture. Here you can find player heads: https://minecraft-heads.com/ The text you need is the 'Value'. 若你要在这个格子使用自定义头颅材质,添加这个参数并填入与之配合的头颅 Base64 值。在 https://minecraft-heads.com/ 你可以找到大多数的自定义头颅,你需要在这里填入的字段是这个网页中显示头颅信息的 'Value' (译者注:通常是一串 Base64 代码) click_commands: -"msg %player% &fHello" -"eco give %player% 5"You can add this option to execute commands from the console for players when they click on this item. If the item represents a Codex discovery, the player must have it unlocked first to execute the command.
If you want to execute a command from the player use: "player_command: <command>" 当你想要玩家在点击这个物品时执行特定命令,那么你就需要用到这个选项。如果这个物品代表着一个本插件的图鉴或分类图鉴,那么玩家需要先解锁这个图鉴才可以使用这个按钮。 若你需要以玩家身份执行一个命令,你可以使用下面这个参数: "player_command: 执行的命令"
脚注 [注1] 原文此处为 "mantain"。 [注2] 原文此处为 "respresent"。 [注3] 原文此处往下开始为表格,为保持翻译一致性,此处采用分条陈述的形式翻译该篇文章。 |
|