Skip to content

速查表

一页纸浓缩。找不到细节时翻到对应章节。

槽位类型

所有槽位都必须指定 id 参数

类型用途核心参数示例
decoration装饰id, material, name, loredecoration(id=边框, material=GLASS, name=" ")
input输入id, match, placeholder, multiple, acceptinput(id=装备, match="...", multiple=true)
output输出idoutput(id=结果)
material材料id, match, amountmaterial(id=材料, match="...", amount=5)
button按钮id, execute/action, sourcebutton(id=确认, material=EMERALD, name="...")
preview预览id, source, scriptpreview(id=预览, source="@装备", script=xxx)
display显示id, material, name, loredisplay(id=信息, material=PAPER, name="{变量}")
toggle开关id, toggleid/toggle, on, offtoggle(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

动作汇总(按分类)

分类动作
Lorelore.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
Namename.set, name.prefix, name.suffix
NBTnbt.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
GUIgui.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

TQ Minecraft Server Plugin Docs