Skip to content

Commit a5469f7

Browse files
dfl: ♻️ refactor: 将软封禁玩家函数改为参数化宏函数
- 将 soft_ban_player 函数改为使用宏参数 $(title) 和 $(subtitle) - 移除不再使用的本地化键名 tick.ban.dfl.ban 和 tick.ban.dfl.from - 更新中英文README文档,添加参数说明 - 函数用法现在支持 {title:"封禁理由",subtitle:"备注"} 参数
1 parent 535df60 commit a5469f7

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

.claude/commands/w.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
调用searchOnWiki工具来完成以下用户任务,如果任务较为复杂,先计划完成步骤,然后使用任务相关内容调用searchOnWiki工具,确保获得足够信息后再开始执行任务
1+
调用searchOnWiki工具来完成以下用户任务,如果任务较为复杂,先计划完成步骤。然后根据任务内容,调用searchOnWiki工具获取相关知识,确保获得足够知识后再开始执行任务
22

33
```
44
$ARGUMENTS

Localization-Resource-Pack/assets/localization_resource_pack/lang/zh_cn.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"tick.ban.dfl.ban": "您已被此服务器软封禁",
3-
"tick.ban.dfl.from": "通过数据包",
42
"tick.show.entity.dfl.entity.num": "实体数量:%s",
53
"tick.kill.dfl.entity.clear.notification": "实体过多,已清除 %s 个实体",
64
"tick.kill.dfl.protection.hint": "想要防止实体被清除可以为实体添加 '%s' 标签",

datapack-function-library/README-en_us.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ Function usage: `/function dfl:start/create_teams {team_blue:"blue",team_red:"re
109109

110110
### Soft ban player
111111

112-
Function usage: `/function dfl:tick/soft_ban_player`
112+
Function usage: `/function dfl:tick/soft_ban_player {title:"Ban Reason",subtitle:"Note"}`
113113

114114
- Note: The executor of this function must be the player to be **banned**, you can use the `/execute` command;
115115
- Realize a soft ban by continuously tp the player to 0 0 0, setting the mode to adventure, and continuously giving the player negative buffs;
116116
- Must be executed every Tick;
117-
- Example: `/execute as @a[tag=ban] run function dfl:tick/ban`.
117+
- Title is {title}, subtitle is {subtitle};
118+
- Example: `/execute as @a[tag=ban] run function dfl:tick/soft_ban_player {title:"Ban Reason",subtitle:"Note"}`.
118119

119120
The effect is as follows:
120121

datapack-function-library/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ execute if score dfl_enable dfl_scoreboard matches 1
109109

110110
### 软封禁玩家
111111

112-
函数用法:`/function dfl:tick/soft_ban_player`
112+
函数用法:`/function dfl:tick/soft_ban_player {title:"封禁理由",subtitle:"备注"}`
113113

114114
- 注意:此函数执行者必须为要**被封禁**的玩家,可以使用 `/execute` 命令;
115115
- 通过不断 tp 玩家到 0 0 0,将模式设为冒险以及不断给予玩家负面 Buff 来实现软封禁;
116116
- 必须每 Tick 执行一次;
117-
- 范例:`/execute as @a[tag=ban] run function dfl:tick/ban`
117+
- 标题为 {title},副标题为 {subtitle};
118+
- 范例:`/execute as @a[tag=ban] run function dfl:tick/soft_ban_player {title:"封禁理由",subtitle:"备注"}`
118119

119120
效果如下:
120121

datapack-function-library/data/dfl/function/tick/soft_ban_player.mcfunction

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ title @s times 0 70 20
1414

1515
# 显示主标题
1616
# 告知玩家已被封禁,使用红色粗体
17-
title @s title \
18-
{"type":"translatable","translate":"tick.ban.dfl.ban","fallback":"您已被此服务器软封禁","color":"red","bold":true}
17+
$title @s title \
18+
{"text":"$(title)","color":"red","bold":true}
1919

2020
# 显示副标题
2121
# 显示封禁来源信息
22-
title @s subtitle \
23-
[{"type":"translatable","translate":"tick.ban.dfl.from","fallback":"通过数据包","color":"gray"},\
22+
$title @s subtitle \
23+
[{"text":"$(subtitle)","color":"gray"},\
2424
{"text":" datapack function library","color":"gray"}]
2525

2626
# 给予负面效果

0 commit comments

Comments
 (0)