
表情提供程序
为复杂的数学和文本表达式添加MiniPlaceholders占位符
Expressions-Provider
为复杂的数学和文本表达式添加 MiniPlaceholders 占位符。
安装
- 安装 MiniPlaceholders
- 根据你使用的平台,将此项目安装到 mods 或 plugins 文件夹中
占位符
基本运算
- 加法 |
<expr_add:n1:n2:...:nX><expr_add:5:2:3>== 10
- 减法 |
<expr_sub:n1:n2><expr_sub:10:3>== 7
- 乘法 |
<expr_mul:n1:n2:...:nX><expr_mul:5:2:3:6>== 180
- 除法 |
<expr_div:n1:n2><expr_div:10:5>== 2
- 除法取余
<expr_mod:n1:n2><expr_mod:5:2>== 1
- 取负 |
<expr_neg:n><expr_neg:5>== -5<expr_neg:-5>== 5
取整
- 向下取整到整数 |
<expr_floor:n><expr_floor:5.05>== 5<expr_floor:2.9>== 2
- 四舍五入到最接近的整数 |
<expr_round:n><expr_floor:5.05>== 5<expr_floor:2.9>== 3
- 向上取整到整数 |
<expr_ceil:n><expr_floor:5.05>== 6<expr_floor:2.9>== 3
- 获取最小值 |
<expr_min:n1:n2:...:nX><expr_min:5:10:15:2:500:9:69>== 2
- 获取最大值 |
<expr_max:n1:n2:...:nX><expr_max:5:10:15:2:500:9:69>== 500
- 从 0 到 1 的随机数 |
<expr_random>| 行为等同于<expr_random:0:1:0.01><expr_random>== 0.15
- 从
min到max的随机整数 |<expr_random:min:max>| 行为等同于<expr_random:min:max:1><expr_random:1:100>== 69
- 从
min到max的随机数,步长为step|<expr_random:min:max:step><expr_random:50:10:0.25>== 68.75
字符串操作
- 连接字符串 |
<expr_concat:s1:s2:...:sN><expr_concat:hello:_:world>== "hello_world"
- 创建
s从第n1到第n2个字符的子字符串 |<expr_substring:s:n1:n2><expr_substring:hello:2:4>== "ll"
- 获取字符串长度 |
<expr_length:s><expr_length:hello>== 5
- 使用 Java String.format() 格式化字符串 |
<expr_format:format:arg1:arg2:...:argX>| 这对用户表达式可能很有用<expr_format:'%s is not a %s':4drian3d:fruit>== "4drian3d is not a fruit"
- 如果
o1和o2相同,则显示r1。否则,显示rs|<expr_if:o1:o2:r1:r2><expr_if:1:2:Equals:NotEquals>== "NotEquals"
- 为具有
uuid的玩家设置text占位符。 |<expr_player:uuid:text><expr_player:4drian3dUUID:<player_name>>== 4drian3d
- 为具有
name的玩家设置text占位符。 |<expr_player:name:text><expr_player:4drian3d:<player_ping>>== 42
- 展开为用户表达式 |
<expr_user:name:arg1:arg2:...:argX>
用户表达式
你可以使用我们的表达式提供者语言(EPL)在 expressions.properties 中创建自己的表达式快捷方式:
add_and_multiply=<expr_add:"<arg1>":"<expr_mul:'<arg2>':'<arg3>'>"> 表示 <expr_user:add_and_multiply:arg1:arg2:arg3> 将被求值为 arg1 + (arg2 * arg3)。
因此,<expr_user:add_and_multiply:2:3:4> 求值为 <expr_add:2:'<expr_mul:3:4>'>,即 2 + (3 * 4) = 14
用户表达式示例
<expr_user:remove_first:s:n>- 从s中移除前n个字符(hello,2->llo),EPL:remove_first=<expr_substring:"<arg1>":"<arg2>":"<expr_length:'<arg1>'>"><expr_user:remove_last:s:n>- 从s中移除后n个字符(hello,2->hel),EPL:remove_last=<expr_substring:"<arg1>":0:"<expr_sub:'<expr_length:"<arg1>">':'<arg2>'>"><expr_user:decimals:n:decimals>- 格式化数字(1.234567,2->1.23),EPL:decimals=<expr_format:"<expr_concat:'%.0':'<arg2>':'f'>":"<arg1>"><expr_user:pad_integer:n:length>- 用零填充整数(12,3->012),EPL:pad_integer=<expr_format:"<expr_concat:'%0':'<arg1>':'d'>":"<arg2>">
嵌套
表达式可以嵌套。试试 /miniplaceholders parse me <expr_add:1:"<expr_add:1:'<expr_add:1:"<expr_add:1:'<expr_add:1:0>'>">'>">
下载
正在加载版本记录…


正在加载评论…
评论在新手盒子客户端中发表,这里同步展示。