速查表
一页纸浓缩。找不到细节时翻到对应章节。
槽位类型
所有槽位都必须指定 id 参数
| 类型 | 用途 | 核心参数 | 示例 |
|---|---|---|---|
| decoration | 装饰 | id, material, name, lore | decoration(id=边框, material=GLASS, name=" ") |
| input | 输入 | id, match, placeholder, multiple, accept | input(id=装备, match="...", multiple=true) |
| output | 输出 | id | output(id=结果) |
| material | 材料 | id, match, amount | material(id=材料, match="...", amount=5) |
| button | 按钮 | id, execute/action, source | button(id=确认, material=EMERALD, name="...") |
| preview | 预览 | id, source, script | preview(id=预览, source="@装备", script=xxx) |
| display | 显示 | id, material, name, lore | display(id=信息, material=PAPER, name="{变量}") |
| toggle | 开关 | id, toggleid/toggle, on, off | toggle(id=锁定, toggle=lock1, on=LIME_DYE, off=GRAY_DYE) |
匹配器(36 个)
type.*(11 个)
| 匹配器 | 说明 | 示例 |
|---|---|---|
type.is(材质) | 精确材质 | type.is(DIAMOND_SWORD) |
type.in(...) | 多材质 / 类型组 | type.in(SWORD, AXE) |
type.isweapon() | 是否武器 | — |
type.isarmor() | 是否护甲 | — |
type.istool() | 是否工具 | — |
type.issword() | 是否剑 | — |
type.isaxe() | 是否斧 | — |
type.ispickaxe() | 是否镐 | — |
type.isshovel() | 是否铲 | — |
type.ishoe() | 是否锄 | — |
type.isbow() | 是否弓 | — |
name.*(5 个)
| 匹配器 | 别名 | 示例 |
|---|---|---|
name.is() | equals() | name.is("传说之剑") |
name.contains() | — | name.contains("神") |
name.regex() | matches() | name.regex(".*\\+\\d+") |
name.starts() | startswith() | name.starts("&6") |
name.ends() | endswith() | name.ends("之剑") |
lore.*(3 个)
| 匹配器 | 别名 | 示例 |
|---|---|---|
lore.contains() | — | lore.contains("可强化") |
lore.regex() | match(), matches() | lore.regex("攻击力.*\\d+") |
lore.line() | — | lore.line(0, "传说装备") |
nbt.*(3 个)
| 匹配器 | 别名 | 示例 |
|---|---|---|
nbt.has() | — | nbt.has("CustomData.Level") |
nbt.is() | equals() | nbt.is("Type", "weapon") |
nbt.contains() | — | nbt.contains("Tag", "rare") |
amount.*(3 个)
| 匹配器 | 别名 | 说明 |
|---|---|---|
amount.is() | equals() | 精确数量 |
amount.min() | atleast() | 最少 |
amount.max() | atmost() | 最多 |
durability.*(3 个)
| 匹配器 | 别名 | 说明 |
|---|---|---|
durability.is() | equals() | 精确耐久 |
durability.min() | — | 最少耐久 |
durability.max() | — | 最多耐久 |
mm.*(2 个)
| 匹配器 | 别名 | 说明 |
|---|---|---|
mm.is() | mm.id() | 匹配 MM 物品 ID |
mm.any() | — | 任何 MM 物品 |
ni.*(2 个)
| 匹配器 | 别名 | 说明 |
|---|---|---|
ni.is() | ni.id() | 匹配 NI 物品 ID |
ni.any() | — | 任何 NI 物品 |
provider.* / item.*(4 个)
| 匹配器 | 别名 | 说明 |
|---|---|---|
provider.is() | provider.id(), item.is(), item.id() | 匹配指定来源物品 |
provider.from() | item.from() | 匹配来源类型 |
provider.from 支持的来源:mm/mythicmobs, ni/neigeitems, mc/minecraft
常用函数
| 分类 | 函数 |
|---|---|
| 数学 | max, min, abs, floor, ceil, round, round(n, decimals), sqrt, pow |
| 随机 | rand, rand_float, weighted_random |
| 字符串 | length, substring, replace, contains, split, format, color, matches, equals, isempty, trim, lowercase, uppercase |
| 时间 | now, date, time, datetime, hour, minute, dayofweek, dayofmonth, month, year |
| 条件 | clamp, between, coalesce, ifnull, typeof |
| 列表(读) | length(最大下标), list_size(元素个数), list_get(支持负数索引), list_contains, list_join, list_index |
| 列表(写) | list_add, list_insert, list_set, list_remove, list_remove_value, list_clear, list_copy |
| 统计 | count_filled, count_on, sum, sum_attr, sum_extract |
| 物品 | item, itemid, isMM, isNI, item.create |
| 冷却 | cooldown, cooldown_ready, cooldown_set, cooldown_clear |
| 玩家 | hasPermission, isOp, papi, papi_parse |
| 存储 | vault.store, vault.get, cx_get, cx_set, cx_add, cxt_get, cxt_set |
不存在的函数:second()、while。
动作汇总(按分类)
| 分类 | 动作 |
|---|---|
| Lore | lore.replace, lore.append, lore.insert, lore.insertAfter, lore.delete, lore.clear, lore.setLine, lore.attr, lore.setAttr, lore.setCounter, lore.setValue, lore.sort, lore.copy, lore.move, lore.random_replace |
| Name | name.set, name.prefix, name.suffix |
| NBT | nbt.set, nbt.add, nbt.remove |
| 物品 | item.give, item.take, item.clear, item.setType, amount.set |
| 经济 | money.take, money.give, points.take, points.give |
| 效果 | effect.message, effect.sound, effect.title, effect.actionbar, effect.particle, effect.potion, effect.command, effect.console, effect.close, effect.refresh, effect.open |
| 槽位 | slot.set, slot.clear, slot.take, slot.lock, slot.unlock |
| GUI | gui.lock, gui.unlock |
| 附魔 | enchant.add, enchant.remove |
| 耐久 | durability.set, durability.repair |
| 延迟 | delay(ticks) |
流程控制
| 语句 | 用途 | 示例 |
|---|---|---|
| if / else | 条件分支 | if 条件 { } else { } |
| for | 数值循环 | for i in 1..10 { } |
| switch | 多分支(case 后冒号可选) | switch 值 { case "a": ... default: ... } |
| chance / fail | 概率执行 | chance 50 { } fail { } |
| with | 批量操作目标物品 | with @input { 装备.lore.attr(...) } |
| require | 条件检查 | require 条件 : "错误消息" |
| try / catch | 错误处理({error} 变量) | try { } catch { effect.message("{error}") } |
| throw | 抛出错误 | throw("错误消息") |
| return | 结束脚本 | return |
| break | 跳出循环 | break |
| continue | 跳过迭代 | continue |
不支持:while 循环未实现,用 for i in 1..N 代替。
重要提示
while循环未实现,用for i in 1..N。second()函数不存在,用time()配合split()解析。dayofweek()返回 1 = 周一 / 7 = 周日(ISO 标准)。list_get()返回深拷贝,修改返回值不会影响原列表,必须list_set写回。lore.sort/lore.copy/lore.move从 v1.3.0 起支持函数式语法和链式调用。effect.message("{物品变量}")对 ItemStack 显示的是描述,不含完整 lore,调试 lore 要 for 循环逐行打印。- 所有函数都支持独立调用(v1.2.1+),如
debug(x)、log("msg")、cooldown_set("key", 60)不需赋值给变量。
统计摘要
- 8 种槽位类型:decoration, input, output, material, button, preview, display, toggle
- 36 种匹配器:type.(11), name.(5), lore.(3), nbt.(3), amount.(3), durability.(3), mm.(2), ni.(2), provider.*(4)
- 147+ 内置函数:数学 / 随机 / 字符串 / 时间 / 条件 / 列表 / 统计 / 玩家 / 冷却 / 物品 / JSON / 存储
- 50+ 动作类型:lore.(15), name.(3), nbt.(3), item.(4), money.(4), effect.(11), slot.(5), enchant.(2), durability.*(2), delay
- 11 种流程控制:if/else, switch/case, for, chance/fail, with, require, try/catch, throw, return, break, continue