Skip to content

内置函数

IM 的脚本自带一套函数库,本节按类别列出。函数名@ 前缀,参数用括号包围。

分类一览

页面覆盖
数学 / 随机 / 字符串max / min / clamp / floor / ceil / round / sqrt / pow / abs / betweenrand / rand_float / weighted_randomlength / substring / replace / lowercase / uppercase / trim / contains / startswith / endswith / split / format / color / matches / equals / isempty
时间 / 条件now / date / time / datetime / hour / minute / dayofweek / dayofmonth / month / yearclamp / between / coalesce / ifnull / typeof
列表 / 统计list_size / list_get / list_contains / list_join / list_index / list_add / list_insert / list_set / list_remove / list_remove_value / list_clear / list_copycount_filled / count_on / sum / sum_extract / sum_attr
物品 / JSONitem / getItem / itemid / isMM / isNI / item.createjson_get / json_has / json_unescapenidata / nidata_debug
外部集成 / 冷却 / 调试hasPermission / isOp / papi / papi_parsecooldown 系列;cx_* / cxt_*lshop_*wh_*vault.*log / debugmatch_recipe

约定

  • 返回值:本文所有表格的"返回值"标注脚本视角的类型(Number / String / Boolean / List / ItemStack / Any / null)。
  • 变长参数... 表示可接受任意个同类型参数,例如 max(a, b, ...)
  • 槽位组参数:像 count_filled(@food) 这样直接传 @xxx 引用的函数,既接受单个槽位也接受槽位组。
  • 副作用函数:如 cooldown_setvault.storecx_set 会修改外部状态,不建议放在 variables 中(每次刷新都会执行)。

下一步:数学 / 随机 / 字符串

TQ Minecraft Server Plugin Docs