世界与时间条件
检查玩家在哪里、现在是什么时候、周围有什么。这一页的 18 种类型在编辑器的「世界与时间」分类里。
例子
只在周末晚上 8 点到 11 点开放的活动任务:
plugins/StarQuest/quests/示例/周末夜猎.yml
format: 1
id: 周末夜猎
name: '&5周末夜猎'
category: 示例
icon: CLOCK
settings:
start: {command: true}
repeat: {mode: daily, reset-time: '04:00'}
requirements:
- {type: weekday, days: [saturday, sunday]}
- {type: realtime, from: '20:00', to: '23:00'}
rewards:
- {type: exp, mode: levels, amount: 2}
nodes:
开始:
type: start
x: 0
y: 100
next: [夜猎]
夜猎:
type: objective
x: 260
y: 100
track-text: 在夜里狩猎
goals:
- type: kill
entity: [ZOMBIE, SKELETON, CREEPER]
amount: 15
display: '夜里击败怪物 {progress}/{amount}'
conditions:
- {type: time, from: 13000, to: 23000}
next: [完成]
完成:
type: end
x: 520
y: 100
result: complete
平日或时间不对时接任务,聊天栏提示「只在 20:00 – 23:00 开放」。接到后白天打怪不会计数。
所在世界 world
world(世界):必填,可写多个
- {type: world, world: [world, world_nether]}
在某地附近 location
location(位置):必填radius(半径):默认 5 格
- {type: location, location: 'world,100,64,-20', radius: 8}
在 WorldGuard 区域 region
需要 WorldGuard。
region(区域):必填,可写多个,在其中一个就算highest(必须是最高优先级的区域):true= 重叠区域时只看优先级最高的那个
- {type: region, region: [主城, 主城_广场]}
所在生物群系 biome
biome(群系):必填,可写多个,例如PLAINS、DESERT、CHERRY_GROVE
- {type: biome, biome: [DESERT, BADLANDS]}
高度 Y height
compare、value(Y 坐标)
- {type: height, compare: '<', value: 0}
亮度 light
玩家脚下那格的亮度,0 到 15。
compare、value(亮度)
- {type: light, compare: '<=', value: 7}
某处是某方块 block
location(位置):必填material(方块):必填,可写多个
- {type: block, location: 'world,105,64,-12', material: [REDSTONE_TORCH]}
看着某方块 looking-at
material(方块):可写多个,不写 = 任何方块location(位置):写了就要看着这一格distance(距离):默认 5 格
- {type: looking-at, material: [BEACON], distance: 10}
游戏内时间 time
世界的时间,单位 tick:0 是早上 6 点,6000 中午,13000 入夜,18000 午夜。from 比 to 大时会跨过 0 点。
from(从):编辑器添加时填 13000to(到):编辑器添加时填 23000world(世界):不写 = 玩家所在的世界
- {type: time, from: 13000, to: 23000}
现实时间 realtime
现实中的时段,可以跨午夜,例如 22:00 到 02:00。时区看 config.yml 的 timezone,空 = 服务器时区。
from(从):编辑器添加时填18:00to(到):编辑器添加时填23:59
- {type: realtime, from: '22:00', to: '02:00'}
星期几 weekday
days(星期):必填,可写多个,monday到sunday
- {type: weekday, days: [friday, saturday]}
日期 date
现实日期,每一项都可以不写。
day(日):例如1-7,15month(月):例如12year(年):例如2026from(从)、to(到):完整日期,例如2026-12-24
- {type: date, from: '2026-12-24', to: '2026-12-31'}
天气 weather
玩家所在世界的天气。
weather(天气):必填,clear晴、rain雨、storm雷雨
- {type: weather, weather: storm}
月相 moon
phase(月相):必填,可写多个。0满月、1亏凸月、2下弦月、3残月、4新月、5蛾眉月、6上弦月、7盈凸月
- {type: moon, phase: ['0']}
附近的生物 entities
周围有几只某种生物,玩家不算。
entity(生物):可写多个mythic(MythicMobs ID):写了就只数这种 MythicMobs 怪radius(半径):默认 10 格compare、value(数量)name(名称包含)location(中心):不写 = 玩家
- {type: entities, entity: [ZOMBIE], radius: 16, compare: '=', value: 0, message: '&e先把附近的僵尸清干净'}
离 NPC 多近 npc-distance
npc(NPC):必填distance(距离):默认 5 格
- {type: npc-distance, npc: 村长, distance: 8}
在线人数 online
compare、value(人数)
- {type: online, compare: '>=', value: 5}
所在子服 server
看 config.yml 的 server-id,跨服时用来区分子服。
servers(子服 ID):必填,可写多个
- {type: server, servers: [lobby]}
会踩的坑
手写时 time 不写 from / to 等于整天成立,realtime 不写等于 00:00 到 23:59。编辑器帮你填的晚上时段只在编辑器里添加时才有。
realtime 的时刻一定要加引号写成 '20:00',不加的话 YAML 会把它读成一个数字。
server 的 server-id 留空时插件会自动产生一个,要用这个条件就在每台子服的 config.yml 填好名字。