PlaceholderMaker
概述
PlaceholderMaker 是一款 Fabric 模组,允许你创建使用条件和规则来生成独特且无限的占位符的占位符,甚至可以创建嵌套在其他占位符中的占位符,这些占位符利用检测机制在游戏过程中根据占位符的变化动态更新。
工作原理
- 它通过为占位符配置的
json 规则中的条件工作,这些条件检测来自配置中使用的其他占位符的变化!
- 通过使用 Placeholder API 以及任何类型的模组中的其他占位符来实现!
- 占位符可以在
pmaker/placeholders 中的 json 文件中创建,并在游戏中这样使用 %pm:player_health%
命令与权限
/pm reload
- 权限:
pm.reload(或操作员等级 ≥ 2)
- 重新加载来自
config/pmaker/placeholders/ 的所有占位符配置文件。
- 在编辑或添加新的占位符 JSON 文件后使用此命令。
条件
| 运算符 |
含义 |
示例 |
< |
小于 |
"<3" → 如果值 < 3 |
> |
大于 |
">12" → 如果值 > 12 |
<= |
小于或等于 |
"<="5" → 如果值 ≤ 5 |
>= |
大于或等于 |
">=10" → 如果值 ≥ 10 |
= |
等于 |
"=3" → 如果值 == 3 |
! |
不等于 |
"!3" → 如果值 != 3 |
% |
检查值是否能被整除 |
"%5" → 如果值 % 5 == 0 |
null |
如果为空 |
直接显示消息 |
示例:创建占位符
下面是一个简单的 JSON 文件示例,你可以将其放置在 config/pmaker/placeholders/health_status.json 中。这将创建一个名为 health_status 的占位符,引用 %player:health%,然后根据玩家的生命值决定显示哪段文本。
{
"placeholders": [
{
"placeholderid": "health_status",
"placeholder": "%player:health%",
"rules": [
{
"condition": "<3",
"text": "&cYou're about to die!"
},
{
"condition": "<6",
"text": "&eHang in there, warrior!"
},
{
"condition": null,
"text": "&aYou look perfectly healthy!"
}
]
}
]
}
文本格式
示例
-
粗体、斜体、下划线、删除线、混淆
<b>Bold text</b>
<i>Italic text</i>
<u>Underlined text</u>
<strike>Strikethrough text</strike>
<obf>Obfuscated text</obf>
-
十六进制颜色
<#FF0000>This text is red</#>
<#00FF00>This text is green</#>
-
渐变
<gradient:#FF0000:#FFFF00:#00FF00>Hello Gradient!</gradient>
- 可以使用多个以“:”分隔的十六进制颜色(例如
#FF0000:#0000FF:#00FF00)。
- 解析器将在文本上混合颜色。
-
点击事件
<click:run_command:'/say Hello'>Click to run a command</click>
<click:suggest_command:'/help'>Click to suggest a command in chat</click>
<click:open_url:'https://example.com'>Click to open a website</click>
<click:copy_to_clipboard:'Copied!'>Click to copy text</click>
- 注意:
run_command 的执行方式相当于玩家在聊天栏中输入该命令,因此需要相应的权限。
-
悬停事件
<hover:show_text:'Hover message here'>Hover over me</hover>
-
链接
<link:>Click to open Google</link>
- 等同于
click:open_url 事件。
-
重置
<reset> 或 <r> 会将所有格式重置为默认状态。
-
原版格式化代码
- 使用
& 后跟代码(例如 &a, &l, &r):
&l = 粗体
&o = 斜体
&n = 下划线
&m = 删除线
&k = 混淆
&r = 重置
&0-&f = 颜色代码
PlaceholderMaker
Overview
PlaceholderMaker is a Fabric mod that allows you to create placeholders that use conditions and rules to create unique and unlimited placeholders and even placeholders that are inside other placeholders that use detect to change during the game using conditions that detect changes from placeholders.
How It Works
- It works using conditions from rules in configure
json made for placeholders, conditions detect changes from other placeholders that are used in configs from the placeholder!
- Doing this using Placeholder API, and other placeholders from any type of mod!
- Placeholders can be created in a
json file in pmaker/placeholders and can be used in the game like this %pm:player_health%
Commands and Permissions
/pm reload
- Permission:
pm.reload (or Operator Level ≥ 2)
- Reloads all placeholder configuration files from
config/pmaker/placeholders/.
- Use this after editing or adding new placeholder JSON files.
Conditions
| Operator |
Meaning |
Example |
< |
Less than |
"<3" → if value < 3 |
> |
Greater than |
">12" → if value > 12 |
<= |
Less than or equal to |
"<="5" → if value ≤ 5 |
>= |
Greater than or equal to |
">=10" → if value ≥ 10 |
= |
Equal to |
"=3" → if value == 3 |
! |
Not equal to |
"!3" → if value != 3 |
% |
Checks if value is divisible by |
"%5" → if value % 5 == 0 |
null |
If it is null |
Show the message directly |
Example: Creating a Placeholder
Below is a simple JSON file example you might place in config/pmaker/placeholders/health_status.json. This will create a placeholder health_status that references %player:health% and then decides which text to display based on the player’s health.
{
"placeholders": [
{
"placeholderid": "health_status",
"placeholder": "%player:health%",
"rules": [
{
"condition": "<3",
"text": "&cYou're about to die!"
},
{
"condition": "<6",
"text": "&eHang in there, warrior!"
},
{
"condition": null,
"text": "&aYou look perfectly healthy!"
}
]
}
]
}
Text Formats
Examples
-
Bold, Italic, Underline, Strikethrough, Obfuscated
<b>Bold text</b>
<i>Italic text</i>
<u>Underlined text</u>
<strike>Strikethrough text</strike>
<obf>Obfuscated text</obf>
-
Hex Colors
<#FF0000>This text is red</#>
<#00FF00>This text is green</#>
-
Gradient
<gradient:#FF0000:#FFFF00:#00FF00>Hello Gradient!</gradient>
- You can use multiple hex colors separated by “:” (e.g.
#FF0000:#0000FF:#00FF00).
- The parser will blend colors across the text.
-
Click Events
<click:run_command:'/say Hello'>Click to run a command</click>
<click:suggest_command:'/help'>Click to suggest a command in chat</click>
<click:open_url:'https://example.com'>Click to open a website</click>
<click:copy_to_clipboard:'Copied!'>Click to copy text</click>
- Note:
run_command is executed as if the player typed it in chat, so it requires permissions.
-
Hover Events
<hover:show_text:'Hover message here'>Hover over me</hover>
-
Links
<link:>Click to open Google</link>
- Equivalent to a
click:open_url event.
-
Reset
<reset> or <r> resets any formatting to default.
-
Vanilla Formatting Codes
- Use
& followed by a code (e.g. &a, &l, &r):
&l = bold
&o = italic
&n = underline
&m = strikethrough
&k = obfuscated
&r = reset
&0-&f = color codes
评论 0
登录后参与评分
还没有评论,来抢沙发吧