条件
插件提供了强大的条件系统。您可以同时使用简单条件和复杂条件。这里有一些例子供您学习条件。
简单的生物群系条件仅包含必要的参数
biome:
- minecraft:ocean
- minecraft:deep_ocean
- minecraft:cold_ocean
- minecraft:deep_cold_ocean
- minecraft:frozen_ocean
- minecraft:deep_frozen_ocean
- minecraft:lukewarm_ocean
- minecraft:deep_lukewarm_ocean
- minecraft:warm_ocean
复杂条件允许您使用相同类型的条件并添加
not-met-actions
部分名称(本例中为“requirement_permission_1”)是完全可自定义的,只要它不与条件类型名称冲突即可。
# 此示例使用了两个权限条件
requirement_permission_1:
type: permission
value:
- xxx.1.xxx
requirement_permission_2:
type: permission
value:
- xxx.2.xxx
not-met-actions: #译者注:当以上所有条件未命中会执行此动作组
action_1:
type: xxx
value: ...
# 错误用法(YAML 格式不允许这样做)
permission:
- xxx.1.xxx
permission:
- xxx.2.xxx
条件库
time(游戏时间 0~23999)
time:
- 0~1000
- 2000~6000
advanced_requirement:
type: time
value:
- 0~1000
- 2000~6000
ypos(玩家的 Y 坐标)
ypos:
- 0~43
- -45~12
advanced_requirement:
type: ypos
value:
- 0~43
- -45~12
biome(支持自定义生物群系)
biome:
- minecraft:plains <- 白名单
'!biome':
- minecraft:plains <- 黑名单
advanced_requirement:
type: biome
value:
- minecraft:plains
advanced_requirement:
type: '!biome'
value:
- minecraft:plains
world
world:
- world
'!world':
- blacklist_world
advanced_requirement:
type: world
value:
- world
advanced_requirement:
type: '!world'
value:
- blacklist_world
weather
weather:
- thunder
- clear
- rain
advanced_requirement:
type: 'weather'
value:
- thunder
- clear
- rain
date(现实世界日期)
date:
- 12/25
- 6/1
advanced_requirement:
type: 'date'
value:
- 12/25
- 6/1
permission
permission: customfishing.admin
'!permission': blacklist.perm
advanced_requirement:
type: 'permission'
value: customfishing.admin
advanced_requirement:
type: '!permission'
value: blacklist.perm
“>” “>=” “<” “<=” “=” “!=”
'='
value1: '20'
value2: '%player_health%'
advanced_requirement:
type: '='
value:
value1: '20'
value2: '%player_health%'
“startsWith” “endsWith” “equals” “contains” “in-list”
'!startWith':
value1: '%player_name%'
value2: 'X' <- 不以 "X" 开头的玩家名称
advanced_requirement:
type: 'contains'
value:
value1: '%player_name%'
value2: '_' <- 包含 "_" 的玩家名称
advanced_requirement:
type: '!equals'
value:
value1: '%player_name%'
value2: 'XiaoMoMi' <- 不等于 "XiaoMoMi" 的玩家名称
advanced_requirement:
type: 'in-list'
value:
papi: '%player_name%'
values:
- 'XiaoMoMi'
- 'XIAOMOMI'
- 'XlA0M0Ml'
logic(创建复杂条件)
advanced_requirement:
type: '&&'
value:
in-lava: true
requirement_time:
type: time
value:
- 0~12000
'||':
world:
- world_nether
'&&':
ypos:
- -64~-32
world:
- world
level(玩家经验等级)
level: 10
advanced_requirement:
type: 'level'
value: 10
random(0~1)
random: 0.3 <- 30% 的几率
advanced_requirement:
type: 'random'
value: 0.7 <- 70% 的几率
cooldown
cooldown:
key: unique
time: 1000 #毫秒
advanced_requirement:
type: 'cooldown'
value:
key: A
time: 100 #毫秒
regex
regex:
papi: %xxx%
regex: "[A-Z]"
advanced_requirement:
type: 'regex'
value:
papi: %xxx%
regex: "[A-Z]"
environment
environment:
- normal
- nether
- the_end
advanced_requirement:
type: '!environment'
value:
- nether
- the_end
- custom
potion-effect
potion-effect: "LUCK>=0"
advanced_requirement:
type: 'potion-effect'
value: "LUCK!=-1"
"-1": 玩家没有此药水效果
"值不低于0": 药水效果的等级
示例:
LUCK==1
LUCK<5
LUCK>=0
temperature
temperature:
- 0.15~0.85
advanced_requirement:
type: "temperature"
value:
- 0.15~0.85
sneak
sneak: true
advanced_requirement:
type: "sneak"
value: true
plugin-level
plugin-level:
plugin: AureliumSkills
level: 10
target: FARMING
advanced_requirement:
type: plugin-level
value:
plugin: AureliumSkills
level: 10
target: FARMING
season
season:
- Spring
advanced_requirement:
type: season
value:
- Spring
condition_season:
type: suitable-season
value:
- Spring
condition_season:
type: unsuitable-season
value:
- Winter
fertilizer
fertilizer:
has: true
fertilizer:
has: false
advanced_requirement:
type: fertilizer
value:
has: true
advanced_requirement:
type: fertilizer
value:
has: true
key:
- speed_grow_1
- speed_grow_2
item-in-hand
item-in-hand:
item: "AIR"
item-in-hand:
item: "*" # 任意物品
advanced_requirement:
type: item-in-hand
value:
hand: other # 另一只手
item: "PAPER"
amount: 32
light / natural-light
light:
- 0~7
natural-light:
- 7~14
advanced_requirement:
type: light
value:
- 0~1
- 3~5
condition_light:
type: natural-light-more-than
value: 8
condition_light:
type: natural-light-less-than
value: 8
condition_light:
type: light-less-than
value: 8
condition_light:
type: light-more-than
value: 7
gamemode
gamemode:
- creative
advanced_requirement:
type: gamemode
value:
- creative
- adventure
crow attack
condition_xxx:
type: crow-attack
value:
chance: 0.005
fly-model: crow_fly
stand-model: crow_stand
water more than (适用于自定义作物盆)
condition_xxx:
type: water-more-than
value: 0
ondition_xxx:
type: water-more-than
value:
y: -1 # 如果未设置,y 默认为 -1
value: 0
water less than (适用于自定义作物盆)
condition_xxx:
type: water-less-than
value: 1
condition_xxx:
type: water-less-than
value:
y: -1 # 如果未设置,y 默认为 -1
value: 1
point more than
condition_xxx:
type: point-more-than
value: 1
point less than
condition_xxx:
type: point-less-than
value: 1
moisture more than (适用于原版耕地)
condition_xxx:
type: moisture-more-than
value: 0
condition_xxx:
type: moisture-more-than
value:
y: -1 # 如果未设置,y 默认为 -1
value: 0
moisture less than (适用于原版耕地)
condition_xxx:
type: moisture-less-than
value: 1
condition_xxx:
type: moisture-less-than
value:
y: -1 # 如果未设置,y 默认为 -1
value: 1
pot
condition_xxx:
type: pot
value:
y: -1
id:
- default
fertilizer
condition_xxx:
type: fertilizer
value:
- speed_grow_1
# 没有肥料
condition_xxx:
type: fertilizer
value:
has: false
# 黑名单id
condition_xxx:
type: fertilizer
value:
has: false
type:
- speed_grow_1
- soil_retain_2
# 白名单id
condition_xxx:
type: fertilizer
value:
has: true
type:
- speed_grow_1
- speed_grow_2
- speed_grow_3
fertilizer类型
condition_xxx:
type: fertilizer-type
value:
- SPEED_GROW
# 没有肥料
condition_xxx:
type: fertilizer
value:
has: false
# 黑名单类型
condition_xxx:
type: fertilizer
value:
has: false
type:
- speed_grow
- soil_retain
# 白名单类型
condition_xxx:
type: fertilizer
value:
has: true
type:
- speed_grow
region (需要WorldGuard)
advanced_requirement:
type: region
value:
mode: 1 # 1,2
values:
- a
- b
region:
mode: 2
values:
- a
- b
最后更新于