条件
介绍
插件提供了一个强大的条件系统。您可以同时使用简单条件和复杂条件。以下是一些条件示例供您学习。
注意:在某些情况下,“条件”和“要求”可以互换使用;这取决于具体情况。例如,我们可能会说一个物品出现的“条件”,但当谈论使用钓鱼竿的先决条件时,我们会说“要求”。
简单生物群系条件
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
复杂生物群系条件
requirement_biome:
type: biome
value:
- 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
您一定想知道为什么有两种写条件的方式。这是因为有些条件需要在不满足条件时提供反馈。例如,如果您想要向钓鱼竿添加一个权限节点,并在玩家不能使用它时通知他们,那么单独的简单条件就不能满足配置文件的要求。
以下是钓鱼竿的示例
star_fishing_rod:
material: fishing_rod
requirements:
requirement_1:
type: permission
value: star_fishing_rod.use
not-met-actions: <- 可选部分
action_1:
type: message
value: '您不能使用这根钓竿!' <- 反馈
条件库
time(Minecraft 游戏时间 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
in-lava (如果鱼钩在熔岩中)
in-lava: true
advanced_requirement:
type: in-lava
value: true
in-water (如果鱼钩在水中)
in-water: true
advanced_requirement:
type: in-water
value: true
in-void (如果鱼钩在虚空)
in-void: true
advanced_requirement:
type: in-void
value: true
ice-fishing(如果鱼钩在冻结的河流中)
ice-fishing: true
advanced_requirement:
type: ice-fishing
value: true
open-water(如果鱼钩在开放水域中)
open-water: true
advanced_requirement:
type: open-water
value: true
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
region (2.2.10及以上版本)
advanced_requirement:
type: region
value:
position: other # other/player (大多数情况下,‘other’=hook 的位置)
mode: 1 # 1,2
values:
- a
- b
region:
position: other
mode: 2
values:
- a
- b
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
season(需要 RealisticSeasons/CustomCrops)
season:
- summer
- spring
- autumn
- winter
advanced_requirement:
type: 'season'
value:
- summer
- spring
- autumn
- winter
“>” “>=” “<” “<=” “==” “!=”(用于数字)
'==':
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'
rod
rod:
- starter_rod
'!rod':
- FISHING_ROD <- 原版鱼竿
advanced_requirement:
type: 'rod'
value:
- starter_rod
hook
hook:
- delicate_hook
has-hook: false
advanced_requirement:
type: '!hook'
value:
- bad_hook
advanced_requirement:
type: 'has-hook'
value: true
bait
bait:
- starter_bait
has-bait: true
advanced_requirement:
type: '!bait'
value:
- shark_bait
advanced_requirement:
type: 'has-bait'
value: true
loot(这可以用于游戏条件)
loot:
- tuna_fish
advanced_requirement:
type: '!loot'
value:
- shark
plugin-level
plugin-level:
plugin: mcMMO
level: 10
target: FISHING
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 #ms
advanced_requirement:
type: 'cooldown'
value:
key: A
time: 100 #ms
regex
regex:
papi: %xxx%
regex: "[A-Z]"
advanced_requirement:
type: 'regex'
value:
papi: %xxx%
regex: "[A-Z]"
item-in-hand
item-in-hand:
amount: 1
hand: main
item:
- APPLE
- star_rod
advanced_requirement:
type: 'item-in-hand'
value:
hand: off
amount: 1
item:
- APPLE
- star_rod
money
money: 100
advanced_requirement:
type: 'money'
value: 100
in-bag(物品是否在钓鱼包中)
in-bag: false
advanced_requirement:
type: 'in-bag'
value: true
competition(如果正在进行比赛)
competition:
ongoing: true
id: <- 可选
- example_competition
advanced_requirement:
type: 'competition'
value:
ongoing: false
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
has-stats(如果战利品的统计数据已启用)
has-stats: true
advanced_requirement:
type: 'has-stats'
value: "true
has-size(如果战利品是物品类型且具有大小属性)
has-size: true
advanced_requirement:
type: 'has-size'
value: "true
loot-type
loot-type:
- item
'!loot-type':
- entity
- block
advanced_requirement:
type: 'loot-type'
value: item
moon-phase
moon-phase:
- "full_moon"
- "waning_gibbous"
- "last_quarter"
- "waning_crescent"
- "new_moon"
- "waxing_crescent"
- "first_quarter"
- "waxing_gibbous"
impossible
impossible: true
advanced_requirement:
type: 'impossible'
equipment
advanced_requirement:
type: 'equipment'
value:
# CHEST, LEGS, HEAD, FEET
slot: HEAD
item:
- LEATHER_HELMET # 原版物品
- custom_helmet # CustomFishing 物品
- ItemsAdder:namespace:helmet # 来自其他插件的物品
- Oraxen:helmet
最后更新于