注意:此模组仅限服务端,无法在客户端运行,且需要 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 让你的消息更加生动(例如 <Red>)。同时自动检测消息中的链接也有效(但你只能在消息开头应用一种颜色,其他颜色将不起作用)。
2.4.8 支持的事件
first_death - 当玩家首次死亡时执行。
death - 当玩家死亡时执行。
first_join - 当玩家首次加入服务器时执行。
join - 当玩家加入服务器时执行。
kill_entity - 当玩家击杀一个实体时执行。额外标记:
${killedEntity} - 被击杀的实体。
kill_player - 当玩家击杀另一个玩家时执行。额外标记:
${killedPlayer} - 被击杀的玩家。
leave - 当玩家离开服务器时执行。
get_advancement - 当玩家获得成就时执行。额外标记:
${advancement} - 成就的文字描述。
custom_commands - 通过定义命令触发的自定义事件。注意:此事件不支持数据包函数
2.4.7 及之后版本支持的自定义动作
#you_item_id_value(例如 minecraft:stone:3) - 给予你 3 个石头方块
*sound_id - 在本地为玩家播放声音或全局播放(取决于布尔值
broadcast_to_everyone 的值)
@you_command_without_/ - 注册带有 luckperms 权限的自定义命令(例如
@gm1 执行命令 /gamemode 1,在 lp 编辑器中你需要添加 @gm1 权限)
Note: this mod is server side only and won't work on clients and Mod require LuckPerms mod!
A Fabric mod that executes and sends configurable commands (with custom permissions), actions (such as playing sound, give items) and messages respectively on certain events triggered by a player, such as Dying, Joining a server, Killing another player, getting achievements, etc. Also, this mod removes vanilla messages about death, entry/exit of players.
The config file is located in the config directory (config/player_events.json) and looks like this:
{
"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
}
]
}
On the JSON file you can declare, under the actions array on each <event> object, what is going to be sent and/or executed on that event. You can also set these messages to be sent only to the player by setting broadcast_to_everyone to false (if you have audio playback set up, then it will only be played to the player), but this won't work with events like leave (because the player isn't in the server anymore). Use /pe reload or /player_events reload to reload the mod config.
Since 2.2.0 You can choose to randomly send one of the defined messages for a given event by setting pick_message_randomly to true.
Every event has a ${player} token, and each instance of this token will be replaced with the player that triggers the event. Other events have extra tokens that work the same way. Most (if not all) tokens have properties that can be accessed with something like ${player.name}. Here is a list of all the properties:
display Entity's display name, the one you see in the player list/chat. Example: "[Team blue] Tom421"
entityName Entity's name, for players it's the player's name, for other entities it's the entity's uuid
x y z Entity coordinates
More coming soon™
Only for event get_advancement has a ${advancement} - returns the clickable name of the achievement.
Use Simple Text Format to brighten up your messages (like this <Red>). Also auto-detecting links in the messages works (but you can only apply one color at the beginning of the message, other colors will not apply).
2.4.8 supported events
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 and later supported custom actions
#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)
评论 0
登录后参与评分
还没有评论,来抢沙发吧