Yolo - 一个硬核插件
内容
- 此插件的作用
- 配置
config.yml
chat_messages.properties
discord/[...].json
ban_message.txt
- 文本替换
- 权限
- 命令
- 其他注意事项
- 计划功能
- 面向开发者
1. 此插件的作用
You only live once……顾名思义。
此插件旨在用于硬核生存服务器,它实现并扩展了原版 Minecraft 中玩家在世界生成前已在 server.properties 中启用硬核模式时的死亡机制。
通常,如果玩家在服务器上死亡,他们会被踢出服务器(前提是在世界生成之前已在 server.properties 中启用了硬核设置)。
但如果该设置是事后改为 true,则不会发生这种情况。
这正是本插件发挥作用的地方,无论何时启用硬核模式,它都会实施这种行为。
此外,您可以豁免某些玩家不受此规则限制,并在(非豁免的)玩家死亡时向 Discord 服务器发送自定义消息。
该插件还可以强制非豁免玩家接受您选择的资源包,默认资源包会将普通生命条替换为硬核心形图标。
(您可以在这里查看该资源包。)
2. 配置
2.1 config.yml
目前共有四个配置部分。
第一部分用于管理发送给非豁免玩家的资源包:
# 您可以指定一个自定义资源包,并关闭对非豁免玩家强制使用该资源包的功能。
resource-pack:
force: true
custom:
use: false
url: ""
sha1: ""
force 选项允许您控制玩家是否必须接受该资源包。(允许的值:true, false)
custom 允许您定义除默认资源包之外的自定义资源包。
use: 设置为 true 以使用自定义包,否则将其设置为 false
url: 自定义包的下载链接。
sha1: 文件的 sha1 校验和。您可以使用
此工具 获取它。
下一部分是用于配置 Spicord 集成:
spicord:
send: false
message_channel_id: ""
send: 是否启用 Spicord 集成。(允许的值:true, false)
message_channel_id: 发送消息的目标频道 ID。您可以使用
此方法 获取它
(您也可以通过在频道选择侧边栏右键单击频道来获取频道 ID 本身)。
在 announce 部分,您可以单独切换消息:
announce:
death:
discord: false
chat: true
totem:
discord: false
chat: true
revive:
discord: false
chat: true
这部分应该很容易理解。
列出的消息是会在相应场合和目标上发送的公告。
允许的值是 true 或 false。
选项 enable-on-non-hc 允许您在非硬核服务器上启用此插件的功能,而最后一个选项 easy-disable 允许您禁用死亡封禁功能,如果其为 true(如果启用了此选项,之前已死亡的玩家仍可加入)。
如果此选项为 true,被封禁的玩家可能需要一段时间才能重新加入服务器。
同样,两者的可接受值均为 true 和 false。
2.2 chat_messages.properties
此文件中定义的消息是可以自定义的聊天消息。
无需添加更多条目。
您还可以使用 MiniMessage 格式使它们变得特别。
有关如何使用此格式的说明,请阅读此处。
2.3 discord/[...].json
在这些文件中,您可以自定义由插件发送的嵌入卡片(embeds)。
您可以使用 此工具 来可视化它们并生成 json 文件。
例如,如果您想自定义玩家死亡时发送的 Discord 消息,您需要将 plugins/yolo/discord/death_message.json 修改为类似以下内容:
{
"embed": {
"title": "%player_name% has died!",
"description": "Press \"F\" to pay respect.",
"color": 16521991,
"author": {
"name": "author name",
"url": "https://discordapp.com",
"icon_url": "https://cdn.modrinth.com/data/ExWUwvY3/a8ab710896279f5c3ed9c377d408a10587f5509d.png"
},
"image": {
"url": "https://media.tenor.com/bMbIAroA0PkAAAAi/rip-rest.gif"
}
}
}
2.4 ban_message.txt
在这里,您可以自定义玩家死亡时看到的封禁消息。
2.5 文本替换
插件发送的每条消息均可使用以下替换变量:
%player_name% - 受影响玩家的名字
%totem_uses% - 消息主体玩家已使用的图腾数量。
%death_message% - 死亡信息,如果玩家已经死亡。(仅在随玩家死亡发送的消息中可用。)
%version% - 插件的当前版本。
3. 权限
一个权限是 yolo.exempt,拥有该权限的玩家将不受插件效果的影响。还有另外两个与命令相关的权限。这些将在 命令 章节中介绍。
有关 Bukkit 及其衍生版权限系统的通用指南,请参阅
此页面。(不过我建议使用像
LuckPerms 这样的权限管理插件。)
4. 命令
目前有两个可用的命令:
/yolo-reload: 此命令可用于重新加载本插件所有依赖配置的项,而无需重启整个服务器。需要 yolo.reload 权限。
/revive [可复活的玩家] <恢复物品栏> <安全传送至死亡位置>: 此命令允许你复活一名
已死亡的玩家,尝试恢复其物品栏并将其传送至死亡地点(如果安全)。它
需要 yolo.revive 权限。你也可以通过将参数设置为 false 来禁用恢复其物品栏和传送功能。(如果你只想禁用传送,则需要显式地将物品栏恢复设置为 true。)
/checkout_death_location 此命令允许你传送到已死亡玩家的死亡位置。这对于检查陷阱和重复物品非常有用。它需要 yolo.revive 权限。
5. 进一步考虑
- 如果在
server.properties 中启用了硬核模式,则默认情况下该资源包会强制应用于所有玩家。(自 0.4.0 版本起可配置)
- 要使用 Spicord,你必须正确配置它。为了将此插件注册为机器人的附加组件(addon),你需要按如下方式添加它:
### ↑ Irrelevant stuff above ↑ ###
[[bots]]
name = "" # Name for the bot here.
enabled = true
token = "" # Your bot's token here
command_support = true # Irrelevant for this plugin's Spicord addon.
command_prefix = "-"
addons = [
# Potentially other addons.
"yolo"
]
### ↓ Other irrelevant stuff below ↓ ###
- 本插件是为 PaperMC-1.19.4 开发的。 其他版本和平台尚未测试 目前,但计划在正式版本发布前完成支持。如果不兼容的问题可以通过 提交 报告,但如果这意味着放弃对其他兼容版本的支持,这些问题将不会被解决。
- 在启用库存恢复的情况下复活玩家,可能会导致物品重复生成,因为玩家仍然会掉落他们的物品。你可能想先通过
/checkout_death_location 检查传送位置,以查看是否存在重复物品。
- 这是一个预发布版本,因此可能会更频繁地遇到错误或故障。
6. 计划中的功能
- 撤销玩家复活的命令
- 复活系统的图形用户界面(GUI)(计划于 2.0 版本中添加)
- 完全支持 PlaceholderAPI(计划于 2.0 版本中添加)
- Dynmap、Bluemap 等上的死亡位置标记(计划于 2.0 版本中添加)
- 有建议?在此处 提交!
7. 开发者指南
要将此项目作为依赖项添加到你的项目中,请遵循 此链接 并选择你需要的版本(前往 branches → master-SNAPSHOT 获取最新版本)。然后按照以下说明操作。
为了避免膨胀你的 jar 文件,你可以将作用域更改为 compileOnly。
此外,你还需要在 plugin.yml 文件中声明依赖,如下所示:
#### ↑ other stuff ↑ ###
depend: [ # 或 `softdepend`
Yolo
]
#### ↓ other stuff ↓ ###
你可以在这里找到相关文档。
从版本:0.7.0 起
Yolo - A hardcore plugin
Content
- What does this plugin do?
- Configuration
config.yml
chat_messages.properties
discord/[...].json
ban_message.txt
- Text replacements
- Permissions
- Commands
- Further considerations
- Planned features
- For developers
1. What does this plugin do?
You only live once... the name says it all.
This plugin is meant for hardcore survival servers, that implements, but also expands on the vanilla hardcore
mechanics for a player's death on a server.
Upon death players usually get banned off of a server, if (and only if) the setting for hardcore was enabled in
server.properties before world generation.
That is not the case if this setting was set to true retroactively.
And here is, where this plugin comes into play, by
implementing this behaviour regardless of when hardcore was enabled.
Additionally, you can exempt players from this rule
and send a customized message to a Discord-server upon the occurrence of a (non-exempt) player-death.
The plugin can also force a resource-pack of your choice, with the default one replacing the normal health-bar with
hardcore-hearts, on any non-exempt player.
(You can check out the resource-pack
here.)
2. Configuration
2.1 config.yml
There are currently four configuration sections.
The first one is for managing the resource-pack sent to non-exempt players:
# You can specify a custom resource pack and turn off forcing the pack onto non-exempt players.
resource-pack:
force: true
custom:
use: false
url: ""
sha1: ""
- The
force option lets you control, whether the player has to accept the pack. (Allowed values: true, false)
custom lets you define a custom resource-pack, other than the default one.
use: Set to true to use the custom pack, otherwise set it to false
url: The download-link to the custom pack.
sha1: The sha1-checksum of the file. You can use
this tool to obtain it.
The next section is for configuring the Spicord integration:
spicord:
send: false
message_channel_id: ""
send: Whether to enable the Spicord-Integration. (Allowed values: true, false)
message_channel_id: The id of the channel to send the message to. You can obtain it using
this method
(you can also obtain the channel-id by itself, by right-clicking the channel on the channel-selection-sidebar).
In the announce section you can individually toggle messages:
announce:
death:
discord: false
chat: true
totem:
discord: false
chat: true
revive:
discord: false
chat: true
This should be pretty self-explanatory.
The listed messages are announcements that would be sent on their respective occasions and targets.
The allowed values are true or false.
The option enable-on-non-hc lets you enable this plugin's functionality even on a non-hardcore server, while the last
option easy-disable lets you disable the death-ban functionality, if it's true (previously dead players can join, if
this is enabled).
It may take a while before banned players can join if this option is true.
Yet again acceptable values (for both) are true and false.
2.2 chat_messages.properties
The messages defined in this file are chat messages that can be customized.
There shouldn't be a need to add more.
You can also use the MiniMessage format to make them special.
How you can use this format, you can read here.
2.3 discord/[...].json
In these files, you can customize the embeds, sent by the plugin.
You can use this tool to visualize them and generate the json file.
If, for example, you'd like to customize the discord message, that is getting sent upon a player's death, you'd need to
modify plugins/yolo/discord/death_message.json to something like this:
{
"embed": {
"title": "%player_name% has died!",
"description": "Press \"F\" to pay respect.",
"color": 16521991,
"author": {
"name": "author name",
"url": "https://discordapp.com",
"icon_url": "https://cdn.modrinth.com/data/ExWUwvY3/a8ab710896279f5c3ed9c377d408a10587f5509d.png"
},
"image": {
"url": "https://media.tenor.com/bMbIAroA0PkAAAAi/rip-rest.gif"
}
}
}
2.4 ban_message.txt
This is where you can customize the ban message that players see when they're dead.
2.5 Text replacements
Every message that gets sent by the Plugin can use the following replacements:
%player_name% - The name of the affected player
%totem_uses% - The number of totems the subject player of the message has used.
%death_message% - The death message, if the player has died. (only available in messages, sent upon a
player's death.)
%version% - The current version of the plugin.
3. Permissions
One permission is yolo.exempt, which excludes any players having it from the plugin's effects. There are also two
other permissions that relate to commands. These are described in the section about commands.
For a general guide to permissions on Bukkit and its derivatives, please refer to
this page. (I'd recommend using a permission manager like
LuckPerms though.)
4. Commands
There are currently two commands available:
/yolo-reload: This command is useful for reloading all configuration dependent features of this plugin, without
having to restart the whole server. It requires the yolo.reload permission.
/revive [revivable player] <restore inventory> <safe teleport to death location>: This command lets you revive a
player who has died, attempting to restore their inventory and teleporting them to their death location (if safe). It
requires the yolo.revive permission. You can also disable restoring their inventory and the teleportation, by setting
the arguments to false. (If you only want to disable the teleport, you need to explicitly set the inventory restoring
to true.)
/checkout_death_location This command lets you teleport to a dead player's death location. This is useful for
checking for traps and duplicate items. It requires the yolo.revive permission.
5. Further considerations
- If hardcore is enabled in
server.properties, the resource pack is always forced upon players by default. (
configurable since: 0.4.0)
- In order to use Spicord, you have to configure it correctly. In order to register this plugin as an addon for a bot,
you have to add it like this:
### ↑ Irrelevant stuff above ↑ ###
[[bots]]
name = "" # Name for the bot here.
enabled = true
token = "" # Your bot's token here
command_support = true # Irrelevant for this plugin's Spicord addon.
command_prefix = "-"
addons = [
# Potentially other addons.
"yolo"
]
### ↓ Other irrelevant stuff below ↓ ###
- This plugin was made for PaperMC-1.19.4. Other versions and platforms haven't been tested yet, but this is
planned
to be completed until the full release. Issues for incompatibility can
be submitted, but will not be resolved if
this means dropping support for other compatible versions.
- Reviving a player with inventory restoring enabled, can lead to item duplication, as players still drop their items.
You may want to check out the teleport location with
/checkout_death_location first, in order to check for duplicates.
- This is a pre-release version, so bugs or glitches may be encountered more often.
6. Planned features
- Commands to undo a player's revive
- GUI for the revive-system (planned for 2.0)
- Full support for PlaceholderAPI (planned for 2.0)
- Death location marker on Dynmap, Bluemap and co. (planned for in 2.0)
- Have a suggestion? Submit it here!
7. For developers
To add this project as a dependency for yours, follow this link and select
your desired version (go to branches → master-SNAPSHOT for the most recent version). Then follow the instructions
below.
To avoid inflating your jar-file, you can change the scope to compileOnly.
Additionally, you'll need to declare the dependency in your plugin.yml-file like this:
#### ↑ other stuff ↑ ###
depend: [ # Or `softdepend`
Yolo
]
#### ↓ other stuff ↓ ###
You can find the documentation here.
From Version: 0.7.0
评论 0
登录后参与评分
还没有评论,来抢沙发吧