玩家事件重制版
当玩家死亡、获得成就、离开服务器或加入服务器时,发送自定义消息/命令/给予物品/播放声音。移除关于死亡、玩家进入/退出的原版消息。
注意:此模组仅在服务端运行,在客户端无法工作,并且需要 LuckPerms 模组!
这是一个 Fabric 模组,可在玩家触发的特定事件(例如死亡、加入服务器、击杀其他玩家、获得成就等)上分别执行并发送可配置的命令(带有自定义权限)、动作(例如播放音效、给予物品)和消息。此外,此模组会移除原版关于死亡、玩家进入/退出的消息。
配置文件位于 config 目录中(config/player_events.json),内容如下:
{
"first_death": {
"actions": [
"${player} died for the first time"
],
"broadcast_to_everyone": true,
"pick_message_randomly": false
},
"death": {
"actions": [
"${player} just died!"
],
"broadcast_to_everyone": true,
"pick_message_randomly": false
},
"first_join": {
"actions": [
"Welcome to the server ${player}! Remember to read the rules", "*minecraft:entity.experience_orb.pickup"
],
"broadcast_to_everyone": false,
"pick_message_randomly": false
},
"join": {
"actions": [
"Welcome ${player}",
"/say Hello ${player}",
"<Red>You received 64 stone blocks and 64 planks!",
"#minecraft:stone:64",
"#minecraft:planks:64"
],
"broadcast_to_everyone": true,
"pick_message_randomly": false
},
"kill_entity": {
"actions": [
"${player} <Green>killed ${killedEntity}"
],
"broadcast_to_everyone": true,
"pick_message_randomly": false
},
"kill_player": {
"actions": [
"${player} killed ${killedPlayer}",
"F ${killedPlayer}"
],
"broadcast_to_everyone": true,
"pick_message_randomly": true
},
"leave": {
"actions": [
"Goodbye ${player}!",
"/say Hope to see you soon ${player}", "*minecraft:block.note_block.bass"
],
"broadcast_to_everyone": true,
"pick_message_randomly": false
},
"get_advancement": {
"actions": ["<yellow>> <gold>${player} <yellow>got an achievement ${advancement}!"],
"broadcast_to_everyone": true,
"pick_message_randomly": false
},
"custom_commands": [
{
"command": "/plugins",
"actions": [
"Hey! We don't use plugins"
],
"broadcast_to_everyone": false,
"pick_message_randomly": false
},
{
"command": "/spawn",
"actions": [
"/tp ${player} 0 64 0 0 0"
],
"broadcast_to_everyone": true,
"pick_message_randomly": false
},
{
"command": "@gm 0",
"actions": [
"/gamemode survival ${player}"],
"broadcast_to_everyone": false,
"pick_message_randomly": false
},
{
"command": "@gm 1",
"actions": [
"/gamemode survival ${player}"],
"broadcast_to_everyone": false,
"pick_message_randomly": false
}
]
}
在 JSON 文件中,你可以在每个 <event> 对象的 actions 数组下声明在该事件上要发送和/或执行的内容。你还可以通过将 broadcast_to_everyone 设为 false,使这些消息仅发送给该玩家(如果你设置了音频播放,则只会向该玩家播放),但这对于 leave 这类事件不起作用(因为玩家已不在服务器中)。使用 /pe reload 或 /player_events reload 来重新加载模组配置。
自 2.2.0 起,你可以通过将 pick_message_randomly 设为 true,为给定事件随机发送所定义消息中的一条。
每个事件都有 ${player} 占位符,每次出现该占位符都会被替换为触发该事件的玩家。其他事件还有额外占位符,工作方式相同。大多数(如果不是全部)占位符都有可通过类似 ${player.name} 的方式访问的属性。以下是所有属性的列表:
display 实体的显示名称,即你在玩家列表/聊天中看到的名称。示例:"[Team blue] Tom421" entityName 实体的名称,对于玩家来说是玩家名称,对于其他实体来说是实体的 uuid x y z 实体坐标 更多内容即将推出™ 仅 get_advancement 事件有 ${advancement} - 返回成就的可点击名称。 使用 Simple Text Format 来让你的消息更鲜艳(例如这样 )。消息中的链接自动检测也可用(但你只能在消息开头应用一种颜色,其他颜色不会生效)。
2.4.8 支持的事件
first_death - Executed when a player dies for first time.
death - Executed when a player dies.
first_join - Executed when a player joins for first time.
join - Executed when a player joins.
kill_entity - Executed when a player kills an entity. Extra tokens:
${killedEntity} - the killed entity.
kill_player - Executed when a player kills another player. Extra tokens:
${killedPlayer} - the killed player.
leave - Executed when a player leaves.
get_advancement - Executed when the player receives an achievement. Extra tokens:
${advancement} - the text of advancement.
custom_commands - Custom defined events triggered by using a defined command. Note: This event does not support datapack functions
2.4.7 及之后支持的自定义动作
#you_item_id_value(for example minecraft:stone:3) - Gives you 3 stone block
*sound_id - Play sound locally to player or global (its depends on boolean
broadcast_to_everyone value)
@you_command_without_/ - Registering custom command with permission luckperms (for example
@gm1 executing command /gamemode 1, in lp editor you need to add @gm1 permission)
正在加载版本记录…
正在加载评论…
评论在新手盒子客户端中发表,这里同步展示。