本帖最后由 名副其实 于 2022-11-12 19:23 编辑
【前言】
2022/7/28 16:21
这次性质不一样了,是受人之托将该 Wiki 汉化。
不过一些东西也会像之前那样来,总之,越摆快越好。
2022/11/12 19:23
拖了这么长的时间,总算是弄好了。
现在看来这货的内容还是挺少的,我不应该拖这么长时间.jpg
原帖地址: https://ajneb97.gitbook.io/codex/
SpigotMC 地址: https://www.spigotmc.org/resourc ... ies-1-8-1-19.90371/
【导引】
【前言】
2022/7/28 16:21
这次性质不一样了,是受人之托将该 Wiki 汉化。
不过一些东西也会像之前那样来,总之,越
2022/11/12 19:23
拖了这么长的时间,总算是弄好了。
现在看来这货的内容还是挺少的,我不应该拖这么长时间.jpg
原帖地址: https://ajneb97.gitbook.io/codex/
SpigotMC 地址: https://www.spigotmc.org/resourc ... ies-1-8-1-19.90371/
【导引】
主页 如何开始 分类 教程 GUI 教程 其他配置文件 命令与权限 PlaceholderAPI 变量 自定义可发现物教程 |
本帖最后由 名副其实 于 2023-1-16 14:39 编辑
Codex Wiki
在这里你可以更好地学习如何使用本插件: https://www.spigotmc.org/resources/90371/
插件概述
本插件允许你制作一个 "探索图鉴",在这个图鉴中你的玩家可以了解特定区域、NPC以及怪物的相关信息。本插件为你的服务器添加了一些适当的 RPG 风格,体现在它可以为服务器的一些内容添加更详细的介绍。
你可以创建任何 "图鉴",玩家可以在第一次进入区域、与NPC对话或是杀死怪物时解锁它们。你甚至可以使用控制台命令来解锁特定的图鉴!所以本插件能做到与其他插件搭配,来制作更多类别的探索图鉴。
例如,你可以创建一个 区域图鉴 ,在其中的章节将会随着玩家进入特定城市而解锁。然后玩家可以通过命令 /codex 来获取有关这个城市的更多信息,就这么简单。
插件展示




! 如果你不能加载这些图片,说明你的链接可能有些问题。
这些图片引自 Gitbook 上的原 Wiki。
Codex Wiki
在这里你可以更好地学习如何使用本插件: https://www.spigotmc.org/resources/90371/
插件概述
This plugins allows you to create a "Discoveries Inventory" where your players can access information about specific regions, people, monsters they've encountered. Codex is a plugin that adds a little bit of RPG experience to your Minecraft server, by providing context and lore to the player.
You can create any "Discovery" you want, players will unlock them by entering regions for the first time, talking to NPCs, killing monsters, and you can even unlock discoveries to players by using a console command! So the plugin allows you to create discoveries associated with aspects of other plugins.
For example, you can create a Region Discovery which will be unlocked if the player arrives at certain city. The player has the possibility to access the Codex by using /codex and read the lore of this city which provides more information.
本插件允许你制作一个 "探索图鉴",在这个图鉴中你的玩家可以了解特定区域、NPC以及怪物的相关信息。本插件为你的服务器添加了一些适当的 RPG 风格,体现在它可以为服务器的一些内容添加更详细的介绍。
你可以创建任何 "图鉴",玩家可以在第一次进入区域、与NPC对话或是杀死怪物时解锁它们。你甚至可以使用控制台命令来解锁特定的图鉴!所以本插件能做到与其他插件搭配,来制作更多类别的探索图鉴。
例如,你可以创建一个 区域图鉴 ,在其中的章节将会随着玩家进入特定城市而解锁。然后玩家可以通过命令 /codex 来获取有关这个城市的更多信息,就这么简单。
插件展示




! 如果你不能加载这些图片,说明你的链接可能有些问题。
这些图片引自 Gitbook 上的原 Wiki。
本帖最后由 名副其实 于 2023-1-16 14:39 编辑
如何开始
使本插件在服务器上正常运作的必要信息。
要求
1) Spigot
! 你需要至少 Spigot 或 Paper 或其分支服务端核心才能使插件运作。不要使用 CraftBukkit (译者注:传统的"水桶端")
2) WorldGuard
! 这个插件是完全可选安装的。
若你想要玩家能够通过进入 WorldGuard 插件定义的区域发现特定地点,那么你就需要这个插件。本插件兼容 WorldGuard 的 6.x 和 7.x 版本。
插件地址:https://dev.bukkit.org/projects/worldguard
3) PlaceholderAPI
! 这个插件是完全可选安装的。
若你想要玩家在GUI中使用变量,那你就会用到这个插件。
插件地址:https://www.spigotmc.org/resources/placeholderapi.6245/
4) MythicMobs
! 这个插件是完全可选安装的。
使用这个插件将会允许玩家通过击杀特定怪物解锁图鉴。
插件地址:https://www.spigotmc.org/resources/5702/
插件安装
若要安装此插件,你只需要将插件 jar 文件放入服务器的 plugins 文件夹下,然后启动服务器即可。第一次载入后插件将会在 categories 文件夹下创建示例配置,你可以将它们用作参考,或者删除它们。
如何开始
使本插件在服务器上正常运作的必要信息。
要求
1) Spigot
You need Spigot or Paper for the plugin to work. Don't use Craftbukkit.
! 你需要至少 Spigot 或 Paper 或其分支服务端核心才能使插件运作。不要使用 CraftBukkit (译者注:传统的"水桶端")
2) WorldGuard
This dependency is completely optional.
If you want players to unlock discoveries by entering WorldGuard regions, then you need this plugin. Works with 6.x and 7.x versions.
https://dev.bukkit.org/projects/worldguard
! 这个插件是完全可选安装的。
若你想要玩家能够通过进入 WorldGuard 插件定义的区域发现特定地点,那么你就需要这个插件。本插件兼容 WorldGuard 的 6.x 和 7.x 版本。
插件地址:https://dev.bukkit.org/projects/worldguard
3) PlaceholderAPI
This dependency is completely optional.
If you want to use PlaceholderAPI variables in the inventory then you need this plugin. https://www.spigotmc.org/resources/placeholderapi.6245/
! 这个插件是完全可选安装的。
若你想要玩家在GUI中使用变量,那你就会用到这个插件。
插件地址:https://www.spigotmc.org/resources/placeholderapi.6245/
4) MythicMobs
This dependency is completely optional.
It allows players to unlock discoveries by killing MythicsMobs mobs:
https://www.spigotmc.org/resources/5702/
! 这个插件是完全可选安装的。
使用这个插件将会允许玩家通过击杀特定怪物解锁图鉴。
插件地址:https://www.spigotmc.org/resources/5702/
插件安装
To install the plugin on your server just place the Codex file inside your plugins folder and start your server. Examples will be generated in the categories folder, you can use them as a reference or delete them.
若要安装此插件,你只需要将插件 jar 文件放入服务器的 plugins 文件夹下,然后启动服务器即可。第一次载入后插件将会在 categories 文件夹下创建示例配置,你可以将它们用作参考,或者删除它们。
本帖最后由 名副其实 于 2023-1-16 14:40 编辑
分类 教程
在 categories 文件夹下你可以按你的需要创建任意多的文件。每一个文件都会对应一个 "可发现对象" 的类别。在下一个展示的配置文本中你就可以见到 regions.yml 的内容。接下来我们就会展示分类配置文件中你所有可以配置的选项。
复制代码
分类选项
name: "&c&lWorld &7&lRegions"
此分类的名称。这个名称将会显示在本插件的 GUI 中。
discover_title:
title: "&c&lCODEX UPDATED"
subtitle: "&7Region: %name%"
fade_in: 20
stay: 60
fade_out: 20
在此分类下解锁可发现对象时对玩家发送的标题内容。使用内建变量 %name% 来指代当前被发现的对象 (译者注: 触发解锁新条目内容的可发现对象)。fade_in(标题淡入时间)stay(标题保持时间) 和 fade_out(标题淡出事件) 均以刻为单位。 (20 刻 = 1秒)
若你不想设置发现新条目时触发标题提醒,你完全可以删去这一整段内容。
discover_message:
-"&c&lCODEX UPDATED"
-"&7World Region: %name%"
-"&7Check it now by using &e/codex"
当玩家解锁该分类下新条目时向玩家发送的消息内容。使用内建变量 %name% 来指代当前被发现的对象 (译者注: 触发解锁新条目内容的可发现对象)。你可以在一行内容的开头添加 {centered} 格式占位符来使这行文本居中。
若你不想设置发现新条目时触发消息提醒,你完全可以删去这一整段内容。
discover_sound:
name: BLOCK_GILDED_BLACKSTONE_STEP
volume: 10
pitch: 0.1
当玩家解锁该分类下新条目时向玩家发送的声音。下列链接可以帮你找到你想要的声音。
最新版本:https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
1.8(1.8.8) 版本:https://helpch.at/docs/1.8.8/index.html?org/bukkit/Sound.html
可发现对象 设定
你可以在一个分类中设置不同的可发现对象。这里是一个可发现对象的示例配置:
复制代码
在这个示例中,该可发现对象被命名为 "1",实际上它可以是你想要的任何名称。
name: "&a&lShadow Swamp"
该可发现对象的名称。这个名称将会被展示在本插件此分类的GUI列表中。
lore:
-"&7The shadow swamp is a dark place full of"
-"&7magical creatures. It has been uninhabited"
-"&7for several years."
该可发现对象的描述。这段描述将会被展示在本插件此分类的GUI列表中。
discovered_on_region: shadow_swamp
若你想要玩家在第一次进入 WorldGuard 的区域后解锁这个条目,那么你需要将此选项加入,并在其后添加你需要指定的区域名称。
discovered_on_mob_kill:
type: ZOMBIE
name: "Shadow Warrior"
discovered_on_mob_kill:
type: SKELETON
discovered_on_mob_kill:
mythic_mobs_id: SkeletonKing
若你想要玩家通过击杀实体来解锁这个条目,那么你就需要添加这段设置,并且指定实体的种类和/或名称。
所有有效实体名称一栏:
https://hub.spigotmc.org/javadoc ... ity/EntityType.html
commands:
-"xp give %player% 50"
-"msg %player% &7+50 &6XP"
若你想要玩家在解锁区域后执行命令,那么你就需要填写这个部分的设置。
(译者注: 每一行填入一个命令。)
! 谨记:如果一个可发现对象没有 discovered_on_region 或 discovered_on_mob_kill 参数中的至少一个,那么代表着这个条目仅能通过命令 /codex unlock 解锁。
分类 教程
In the categories folder you can create as many files you want. Each of these files corresponds to one "Discovery" category. In the next example you will see the content of the regions.yml file. Below you will find information about every option you can use here.
在 categories 文件夹下你可以按你的需要创建任意多的文件。每一个文件都会对应一个 "可发现对象" 的类别。在下一个展示的配置文本中你就可以见到 regions.yml 的内容。接下来我们就会展示分类配置文件中你所有可以配置的选项。
- name: "&c&lWorld &7&lRegions"
- discover_title:
- title: "&c&lCODEX UPDATED"
- subtitle: "&7Region: %name%"
- fade_in: 20
- stay: 60
- fade_out: 20
- discover_message:
- - "{centered}&f&m00 00"
- - " "
- - "{centered}&c&lCODEX UPDATED"
- - "{centered}&7World Region: %name%"
- - " "
- - "{centered}&7Check it now by using &e/codex"
- - " "
- - "{centered}&f&m00 00"
- discover_sound:
- name: BLOCK_GILDED_BLACKSTONE_STEP
- volume: 10
- pitch: 0.1
- discoveries:
- 1:
- name: "&a&lShadow Swamp"
- lore:
- - "&7The shadow swamp is a dark place full of"
- - "&7magical creatures. It has been uninhabited"
- - "&7for several years."
- discovered_on_region: shadow_swamp
- 2:
- name: "&a&lCity of Kryngel"
- lore:
- - "&7The center of commerce and the capital of"
- - "&7the Yubbin province."
- discovered_on_region: kryngel
分类选项
name: "&c&lWorld &7&lRegions"
The name of this category. It will be displayed in the
Codex inventory.
此分类的名称。这个名称将会显示在本插件的 GUI 中。
discover_title:
title: "&c&lCODEX UPDATED"
subtitle: "&7Region: %name%"
fade_in: 20
stay: 60
fade_out: 20
The title that will be displayed to the player when
unlocking a discovery from this category. Use the
%name% variable to show the name of the discovery.
fade_in, stay and fade_outoptions
are measured in ticks. (20 ticks = 1 second).
If you don't want to display a title, you can delete
this whole section.
在此分类下解锁可发现对象时对玩家发送的标题内容。使用内建变量 %name% 来指代当前被发现的对象 (译者注: 触发解锁新条目内容的可发现对象)。fade_in(标题淡入时间)stay(标题保持时间) 和 fade_out(标题淡出事件) 均以刻为单位。 (20 刻 = 1秒)
若你不想设置发现新条目时触发标题提醒,你完全可以删去这一整段内容。
discover_message:
-"&c&lCODEX UPDATED"
-"&7World Region: %name%"
-"&7Check it now by using &e/codex"
The message that will be sended to the player when
unlocking a discovery from this category. Use the
%name% variable to show the name of the discovery.
You can use the {centered} tag at the beginning of a
line, to center the message.
If you don't want to send a message, you can delete
this whole section.
当玩家解锁该分类下新条目时向玩家发送的消息内容。使用内建变量 %name% 来指代当前被发现的对象 (译者注: 触发解锁新条目内容的可发现对象)。你可以在一行内容的开头添加 {centered} 格式占位符来使这行文本居中。
若你不想设置发现新条目时触发消息提醒,你完全可以删去这一整段内容。
discover_sound:
name: BLOCK_GILDED_BLACKSTONE_STEP
volume: 10
pitch: 0.1
The sound the player will hear when unlocking a
discovery from this category. Here you can find
all Sound names:
For latest versions:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
For 1.8:
https://helpch.at/docs/1.8.8/index.html?org/bukkit/Sound.html
当玩家解锁该分类下新条目时向玩家发送的声音。下列链接可以帮你找到你想要的声音。
最新版本:https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
1.8(1.8.8) 版本:https://helpch.at/docs/1.8.8/index.html?org/bukkit/Sound.html
可发现对象 设定
You can create different discoveries for the same category. Here is an example of a Discovery:
你可以在一个分类中设置不同的可发现对象。这里是一个可发现对象的示例配置:
- discoveries:
- 1:
- name: "&a&lShadow Swamp"
- lore:
- - "&7The shadow swamp is a dark place full of"
- - "&7magical creatures. It has been uninhabited"
- - "&7for several years."
- discovered_on_region: shadow_swamp
In this case, the discovery is called "1" but you can rename it as you want.
在这个示例中,该可发现对象被命名为 "1",实际上它可以是你想要的任何名称。
name: "&a&lShadow Swamp"
The name of this discovery. It will be displayed in the
discovery message and the Codex inventory.
该可发现对象的名称。这个名称将会被展示在本插件此分类的GUI列表中。
lore:
-"&7The shadow swamp is a dark place full of"
-"&7magical creatures. It has been uninhabited"
-"&7for several years."
Description of this discovery, to be displayed in the
Codex inventory.
该可发现对象的描述。这段描述将会被展示在本插件此分类的GUI列表中。
discovered_on_region: shadow_swamp
If you want the player to unlock this discovery by
entering a WorldGuard region for the first time, you
need to add this option with the region name.
若你想要玩家在第一次进入 WorldGuard 的区域后解锁这个条目,那么你需要将此选项加入,并在其后添加你需要指定的区域名称。
discovered_on_mob_kill:
type: ZOMBIE
name: "Shadow Warrior"
discovered_on_mob_kill:
type: SKELETON
discovered_on_mob_kill:
mythic_mobs_id: SkeletonKing
If you want the player to unlock this discovery by
killing an entity, you need to add this option specifying
the type of the entity, the name of the entity, or both.
You can find all entity types here:
https://hub.spigotmc.org/javadoc ... ity/EntityType.html
You can specify the ID of a MythicMobs mob, just remember to remove the type and name options.
若你想要玩家通过击杀实体来解锁这个条目,那么你就需要添加这段设置,并且指定实体的种类和/或名称。
所有有效实体名称一栏:
https://hub.spigotmc.org/javadoc ... ity/EntityType.html
commands:
-"xp give %player% 50"
-"msg %player% &7+50 &6XP"
If you need to, you can execute commands for the player
when unlocking the discovery.
若你想要玩家在解锁区域后执行命令,那么你就需要填写这个部分的设置。
(译者注: 每一行填入一个命令。)
Remember: If a discovery doesn't have a discovered_on_region or discovered_on_mob_kill option, it means it will only be obtainable by console command! (/codex unlock)
! 谨记:如果一个可发现对象没有 discovered_on_region 或 discovered_on_mob_kill 参数中的至少一个,那么代表着这个条目仅能通过命令 /codex unlock 解锁。
本帖最后由 名副其实 于 2023-1-16 14:40 编辑
GUI 教程
在我的插件中,你可以完全自定义插件的 GUI 显示内容,但这会略微复杂一些!接下来我将为你展示一个带有一个分类的简单示例菜单。
复制代码
你总是会需要修改 "main" 分支下的大部分内容,这些代表着这个插件显示的主GUI内容,也就是输入 /codex 命令时打开的GUI所包含的内容。在这里你可以通过设置内容相同部分的槽位序号来决定它们在GUI中实际显示的物品样式。
如果一个物品代表一个图鉴的分类,那么你就需要为其设置种类参数,以及定义此分类的名称(这一部分在文件名上修改即可)。
这将会允许你使用例如下面一系列的内建变量:
%name% 此分类的名称
%unlocked% 剩余未解锁物品数量
%percentage% 此分类图鉴完成度百分比
%progress_bar% 此分类图鉴完成度进度条
你可以添加 open_inventory 选项以在玩家点击时打开另一个已经存在的 GUI 菜单。那么,在主菜单中将会有一个位于 21 号格子的物品,点击这个物品将会打开 history_discovery 菜单。而在这个菜单中又会有一个在 39 号格子的物品允许玩家在点击后返回主菜单。
若你想要一个物品代表一个可发现物图鉴而不是一个图鉴里的分类,你需要在 type 选项中添加参数,这次你需要在这个分类名称后加上 ; (英文分号),然后是这个图鉴的名字。这会允许你使用一些内建变量: %name% (此图鉴的名称)%lore% (此图鉴的描述)
这是两张示例配置在游戏中的显示效果:


[注3]
GUI 菜单选项
slots: 45
打开此菜单的按钮所在的位置。请使用下列数字:
9, 18, 27, 36, 45, 54
title: "&4Codex &7» &8All Categories"
此菜单的名称。
3
21
26;27;28
在这个位置使用一个数字来代表一个物品在这个菜单中的格子位置。你也可以在同一区域下使用多个格子来达到多个位置显示同一物品的效果。
物品选项
type: regions
type: regions;1
如果此物品代表一个图鉴的分类或一个新的图鉴,那么你就会用到这个格式。
图鉴分类使用下列参数:
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% 来显示这个分类或独立图鉴的名称。
lore:
-"&eIn your adventures you'll find"
-"&esome interesting knowledge."
-""
-"&7Unlocked: %unlocked% &8(&7%percentage%&8)"
物品的描述。你可以在这里使用内建变量 %unlocked% 和 %percentage%。你也可以使用 PlaceholderAPI 变量。
custom_model_data: 1
物品的自定义模型数据值。若想要添加可在此自定义。
open_inventory: regions_discoveries
如果你想要在点击这个物品时打开另一个菜单,你可以添加这个可选选项。
若你需要关闭这个菜单,那么需要使用这个格式:
open_inventory: close
skull_data: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7In(...)
若你要在这个格子使用自定义头颅材质,添加这个参数并填入与之配合的头颅 Base64 值。在 https://minecraft-heads.com/ 你可以找到大多数的自定义头颅,你需要在这里填入的字段是这个网页中显示头颅信息的 'Value' (译者注:通常是一串 Base64 代码)
click_commands:
-"msg %player% &fHello"
-"eco give %player% 5"
当你想要玩家在点击这个物品时执行特定命令,那么你就需要用到这个选项。如果这个物品代表着一个本插件的图鉴或分类图鉴,那么玩家需要先解锁这个图鉴才可以使用这个按钮。
若你需要以玩家身份执行一个命令,你可以使用下面这个参数:
"player_command: 执行的命令"
脚注
[注1] 原文此处为 "mantain"。
[注2] 原文此处为 "respresent"。
[注3] 原文此处往下开始为表格,为保持翻译一致性,此处采用分条陈述的形式翻译该篇文章。
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: 45
Number 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"
Name of this inventory.
此菜单的名称。
3
21
26;27;28
Use 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;1
If 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
Material of this item. Use this names for latest versions:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
Use these names for 1.8:
https://github.com/Attano/Spigot ... ukkit/Material.java
物品的样式。物品名称参考此处:
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: 1
Custom model data of the item if you need to add it.
物品的自定义模型数据值。若想要添加可在此自定义。
open_inventory: regions_discoveries
You 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] 原文此处往下开始为表格,为保持翻译一致性,此处采用分条陈述的形式翻译该篇文章。
本帖最后由 名副其实 于 2023-1-16 14:42 编辑
其他配置文件
config.yml复制代码
Messages.yml复制代码
其他配置文件
config.yml
- # When enabled, names of locked discoveries will be hidden.
- hi de_locked_discoveries_name: true
- # This is the item to be used when a discovery is locked.
- locked_discoveries_item: GRAY_DYE
- locked_discoveries_item_custom_model_data: 0
- # Time in seconds in which player data will be saved automatically.
- data_auto_save_time: 600
- # Properties for the %progress_bar% variable in the inventory.yml file.
- progress_bar_placeholder:
- filled_symbol: "&a|"
- empty_symbol: "&c|"
- amount: 20
-
- # You can enable the MySQL Database for player data storage.
- mysql_database:
- enabled: false
- host: localhost
- port: 3306
- username: root
- password: root
- database: database
Messages.yml
- prefix: "&4[&cCodex&4] "
- noPermissions: "&cYou don't have permissions."
- configReloaded: "&aConfig reloaded."
- commandUnlockErrorUse: "&cYou need to use: &7/codex unlock <player> <category> <discovery>"
- commandNotExists: "&cThat command doesn't exists. Use &7/codex help&c."
- commandResetErrorUse: "&cYou need to use: &7/codex reset <player> <category> <discovery>"
- notOnline: "&cThat player is not online."
- playerNotUnlockedDiscovery: "&cThat player doesn't have unlocked that Codex discovery."
- playerResetDiscovery: "&aDiscovery &7%discovery% &aon category &7%category% &areset for &7%player%&a."
- categoryNotExists: "&cThe category &7%category% &cdoesn't exists."
- discoveryNotExists: "&cThe discovery &7%discovery% &cdoesn't exists for category &7%category%&c."
- playerAlreadyHasDiscovery: "&cPlayer &7%player% &chas already unlocked discovery &7%discovery% &con category &7%category%&c."
- playerUnlockDiscovery: "&aPlayer &7%player% &aunlocked discovery &7%discovery% &aon category &7%category%&a!"
- inventoryUnlockedVariable: "%current%&8/%max%"
- inventoryLockedDiscoveryLore:
- - "&7You haven't unlocked this discovery yet."
- inventoryLockedDiscoveryName: "&c??"
- commandCodexError: "&cThere are errors on the plugin, check the console."
本帖最后由 名副其实 于 2022-11-12 18:59 编辑
命令与权限
! 所有命令唯一权限: codex.admin
命令与权限
命令 | 命令描述 |
/codex | 打开主菜单,不需要任何权限。 |
/codex help | 显示帮助命令。 |
/codex unlock <玩家名称> <探索分类> <可发现物> (可选, 用于发送信息)<true(开启)/false(关闭)> | 为玩家解锁一个探索分类。 (可在任意的其他插件中使用. 在命令末尾添加参数 'false' 可使插件不提示重复解锁的消息) |
/codex reset <玩家名称> <探索分类> <可发现物> | 重置玩家的探索记录。 |
/codex reset <玩家名称> all | 重置玩家的所有记录。 |
/codex reload | 重载配置文件。 |
/codex open <玩家名称> <GUI名称> | 为玩家打开一个菜单。 |
There is just one permission to access commands: codex.admin
! 所有命令唯一权限: codex.admin
本帖最后由 名副其实 于 2022-11-12 19:01 编辑
Placeholder API变量
插件提供了一些可以在GUI中或其他插件中使用的变量。
Placeholder API变量
Codex provides you some PlaceholderAPI variables you can use in the /codex inventory or in another plugin.
变量名称 | 变量描述 |
%codex_total_discoveries% | 玩家已找到的可发现物总数 |
%codex_total_discoveries_<类别>% | 特定分类下玩家已找到的可发现物总数 |
%codex_total_discoveries_percentage% | 玩家已找到的可发现物比例 |
%codex_total_discoveries_percentage_<类别>% | 特定分类下玩家已找到的可发现物比例 |
%codex_has_discovery_<类别>_<可发现物>% | 检查玩家是否解锁了特定的可发现物 |
本帖最后由 名副其实 于 2023-1-16 14:45 编辑
自定义可发现物教程
在这一章节中我会向你解释如何使用我的另一个插件 ConditionalEvents 与本插件进行配合。 ConditionalEvents 允许你在达到特定条件时触发时间,并执行不同的操作。例如,如果玩家捡起了一个物品,或是按下了一个按钮,设置好的一些时间就会被触发。
所以,在我的插件 ConditionalEvents 的帮助下,你可以创建更复杂的可发现物。让我们假设你想要做通过消耗一个物品来解锁一个可发现物的功能,比如吃掉一个苹果,所以我们就可以这样创建分类:复制代码
如你所见,我们只是创建了一个 "食物" 分类下的可发现物(文件名称可以为 food.yml)。所以我们现在就来着手制作一个 ConditionalEvents 触发事件。复制代码
这个事件将会检查玩家是否吃掉了一个名字叫做 "神秘苹果" 的苹果物品,如果检测到,插件将会给予玩家 600 刻 (30 秒) 的力量药水效果,以及以控制台身份执行的一个命令 "/codex unlock %player% food 1"。这将会为该玩家解锁这个可发现物。如果玩家再次吃掉这个苹果,同样的命令将会被执行,但接下来不会发生任何事,因为玩家已经解锁了这个可发现物。
当然一些更为复杂的时间也可以通过此插件的多个事件做到,如果你对我的另一个插件感兴趣的话,你可以点击这里来阅读这个插件的 Wiki 页面。
脚注
ConditionalEvents 国内汉化 Wiki 帖: https://www.mcbbs.net/forum.php?mod=viewthread&tid=1237565
自定义可发现物教程
In this section I will explain you how to use my plugin ConditionalEvents with Codex. ConditionalEvents allows you to assign multiple conditions to a certain event and execute different actions. For example, if a player pickups an item or clicks on a button, something configurable will happen.
在这一章节中我会向你解释如何使用我的另一个插件 ConditionalEvents 与本插件进行配合。 ConditionalEvents 允许你在达到特定条件时触发时间,并执行不同的操作。例如,如果玩家捡起了一个物品,或是按下了一个按钮,设置好的一些时间就会被触发。
So, with my plugin ConditionalEvents you can create as many Codex discoveries you want. Let's suppose you want players to unlock a discovery when they consume an item, for example eat an apple. We create the category first:
所以,在我的插件 ConditionalEvents 的帮助下,你可以创建更复杂的可发现物。让我们假设你想要做通过消耗一个物品来解锁一个可发现物的功能,比如吃掉一个苹果,所以我们就可以这样创建分类:
- name: "&c&lFood"
- discover_title:
- title: "&c&lCODEX UPDATED"
- subtitle: "&7Food: %name%"
- fade_in: 20
- stay: 60
- fade_out: 20
- discover_message:
- - "{centered}&f&m00 00"
- - " "
- - "{centered}&c&lCODEX UPDATED"
- - "{centered}&7Food: %name%"
- - " "
- - "{centered}&7Check it now by using &e/codex"
- - " "
- - "{centered}&f&m00 00"
- discover_sound:
- name: BLOCK_GILDED_BLACKSTONE_STEP
- volume: 10
- pitch: 0.1
- discoveries:
- 1:
- name: "&a&lMystery Apple"
- lore:
- - "&7A mysterious apple found in the cave of"
- - "&7Gashmii. It will give you Strength II for"
- - "&730 seconds."
As you can see we have created just one discovery in the category of "Food" (the name of the file could be food.yml). Now we proceed to create an event with ConditionalEvents:
如你所见,我们只是创建了一个 "食物" 分类下的可发现物(文件名称可以为 food.yml)。所以我们现在就来着手制作一个 ConditionalEvents 触发事件。
- mystery_apple_eat:
- type: item_consume
- conditions:
- - '%item% equals APPLE'
- - '%item_name% equals Mystery Apple'
- actions:
- default:
- - 'give_potion_effect: INCREASE_DAMAGE;600;2'
- - 'console_command: codex unlock %player% food 1'
This event will check if a player tries to eat an Apple called "Mystery Apple". If so, the Strength potion effect will be given to the player for 600 ticks (30 seconds) and the /codex unlock %player% food 1 command will be executed from the console. This will unlock the discovery we have created for the player. If the player eats a Mystery Apple again, the same command will be executed but nothing will happen since the player has already unlocked the discovery.
这个事件将会检查玩家是否吃掉了一个名字叫做 "神秘苹果" 的苹果物品,如果检测到,插件将会给予玩家 600 刻 (30 秒) 的力量药水效果,以及以控制台身份执行的一个命令 "/codex unlock %player% food 1"。这将会为该玩家解锁这个可发现物。如果玩家再次吃掉这个苹果,同样的命令将会被执行,但接下来不会发生任何事,因为玩家已经解锁了这个可发现物。
The same you can do with multiple events you want. If you are interested on my plugin ConditionalEvents you can check the wiki: CLICK HERE
当然一些更为复杂的时间也可以通过此插件的多个事件做到,如果你对我的另一个插件感兴趣的话,你可以点击这里来阅读这个插件的 Wiki 页面。
脚注
ConditionalEvents 国内汉化 Wiki 帖: https://www.mcbbs.net/forum.php?mod=viewthread&tid=1237565