Introduction
Plugin provides a powerful condition system. You can use both simple conditions and advanced conditions at the same time. Here are some examples for you to learn conditions.
Note: In certain contexts, 'condition' and 'requirement' can be used interchangeably; it just depends on the situation. For instance, we might say the 'condition' for a piece of loot to appear, but when talking about the prerequisites for using a fishing rod, we'd say 'requirement'.
simple biome condition
Copy 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
advanced biome condition
Copy 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
You must be wondering why there are two ways of writing conditions. This is because some conditions require feedback for unsatisfied situations. For instance, if you want to add a permission node to a fishing rod and notify the player when they can't use it, a simple condition alone cannot meet the requirements of the configuration file.
Here's the rod example
Copy star_fishing_rod:
material: fishing_rod
requirements:
requirement_1:
type: permission
value: star_fishing_rod.use
not-met-actions: <- optional section
action_1:
type: message
value: 'You cannot use this rod!' <- feedback
Action
Condition Library
time (Minecraft game time 0~23999)
Copy time:
- 0~1000
- 2000~6000
advanced_requirement:
type: time
value:
- 0~1000
- 2000~6000
ypos (Player's Y coordinate)
Copy ypos:
- 0~43
- -45~12
advanced_requirement:
type: ypos
value:
- 0~43
- -45~12
in-lava (If the fishhook is in lava)
Copy in-lava: true
advanced_requirement:
type: in-lava
value: true
in-water (If the fishhook is in water)
Copy in-water: true
advanced_requirement:
type: in-water
value: true
in-void (If the fishhook is in void)
Copy in-void: true
advanced_requirement:
type: in-void
value: true
ice-fishing (If the fishhook is in a frozen river)
Copy ice-fishing: true
advanced_requirement:
type: ice-fishing
value: true
open-water (If the fishhook is in open water)
Copy open-water: true
advanced_requirement:
type: open-water
value: true
biome (Supports custom biomes)
Copy biome:
- minecraft:plains <- whitelist
'!biome':
- minecraft:plains <- blacklist
advanced_requirement:
type: biome
value:
- minecraft:plains
advanced_requirement:
type: '!biome'
value:
- minecraft:plains
world
Copy world:
- world
'!world':
- blacklist_world
advanced_requirement:
type: world
value:
- world
advanced_requirement:
type: '!world'
value:
- blacklist_world
region (requires WorldGuard)
Copy advanced_requirement:
type: region
value:
position: other # other/player (in most cases `other`=hook's position)
mode: 1 # 1,2
values:
- a
- b
region:
position: other
mode: 2
values:
- a
- b
weather
Copy weather:
- thunder
- clear
- rain
advanced_requirement:
type: 'weather'
value:
- thunder
- clear
- rain
date (Real life date)
Copy date:
- 12/25
- 6/1
advanced_requirement:
type: 'date'
value:
- 12/25
- 6/1
permission
Copy permission: customfishing.admin
'!permission': blacklist.perm
advanced_requirement:
type: 'permission'
value: customfishing.admin
advanced_requirement:
type: '!permission'
value: blacklist.perm
season (Requires RealisticSeasons/CustomCrops)
Copy season:
- summer
- spring
- autumn
- winter
advanced_requirement:
type: 'season'
value:
- summer
- spring
- autumn
- winter
“>” “>=” “<” “<=” “==” “!=” (For numbers)
Copy '==':
value1: '20'
value2: '%player_health%'
advanced_requirement:
type: '=='
value:
value1: '20'
value2: '%player_health%'
“startsWith” “endsWith” “equals” “contains” “in-list”
Copy '!startWith':
value1: '%player_name%'
value2: 'X' <- player names that are not starting with "X"
advanced_requirement:
type: 'contains'
value:
value1: '%player_name%'
value2: '_' <- player names that contain "_"
advanced_requirement:
type: '!equals'
value:
value1: '%player_name%'
value2: 'XiaoMoMi' <- player names that not equal "XiaoMoMi"
advanced_requirement:
type: 'in-list'
value:
papi: '%player_name%'
values:
- 'XiaoMoMi'
- 'XIAOMOMI'
- 'XlA0M0Ml'
rod
Copy rod:
- starter_rod
'!rod':
- FISHING_ROD <- vanilla rod
advanced_requirement:
type: 'rod'
value:
- starter_rod
hook
Copy hook:
- delicate_hook
has-hook: false
advanced_requirement:
type: '!hook'
value:
- bad_hook
advanced_requirement:
type: 'has-hook'
value: true
bait
Copy bait:
- starter_bait
has-bait: true
advanced_requirement:
type: '!bait'
value:
- shark_bait
advanced_requirement:
type: 'has-bait'
value: true
loot (This can be used in game conditions)
Copy loot:
- tuna_fish
advanced_requirement:
type: '!loot'
value:
- shark
plugin-level
Copy plugin-level:
plugin: mcMMO
level: 10
target: FISHING
logic (Create complex conditions)
Copy advanced_requirement:
type: '&&'
value:
in-lava: true
requirement_time:
type: time
value:
- 0~12000
'||':
world:
- world_nether
'&&':
ypos:
- -64~-32
world:
- world
level (Player exp level)
Copy level: 10
advanced_requirement:
type: 'level'
value: 10
random (0~1)
Copy random: 0.3 <- 30% chance
advanced_requirement:
type: 'random'
value: 0.7 <- 70% chance
cooldown
Copy cooldown:
key: unique
time: 1000 #ms
advanced_requirement:
type: 'cooldown'
value:
key: A
time: 100 #ms
regex
Copy regex:
papi: %xxx%
regex: "[A-Z]"
advanced_requirement:
type: 'regex'
value:
papi: %xxx%
regex: "[A-Z]"
item-in-hand
Copy 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
Copy money: 100
advanced_requirement:
type: 'money'
value: 100
in-bag (whether item is in fishing bag)
Copy in-bag: false
advanced_requirement:
type: 'in-bag'
value: true
competition (If there's a competition going on)
Copy competition:
ongoing: true
id: <- optional
- example_competition
advanced_requirement:
type: 'competition'
value:
ongoing: false
environment
Copy environment:
- normal
- nether
- the_end
advanced_requirement:
type: '!environment'
value:
- nether
- the_end
- custom
potion-effect
Copy potion-effect: "LUCK>=0"
advanced_requirement:
type: 'potion-effect'
value: "LUCK!=-1"
"-1": Player doesn't have such a potion effect
"value no lower than 0": The potion effect's amplifier
Examples:
LUCK==1
LUCK<5
LUCK>=0
has-stats (If a loot's statistics is enabled)
Copy has-stats: true
advanced_requirement:
type: 'has-stats'
value: "true
has-size (If a loot is item type and has size property)
Copy has-size: true
advanced_requirement:
type: 'has-size'
value: "true
loot-type
Copy loot-type:
- item
'!loot-type':
- entity
- block
advanced_requirement:
type: 'loot-type'
value: item
moon-phase
Copy moon-phase:
- "full_moon"
- "waning_gibbous"
- "last_quarter"
- "waning_crescent"
- "new_moon"
- "waxing_crescent"
- "first_quarter"
- "waxing_gibbous"
advanced_requirement:
type: 'moon-phase'
value:
- full_moon
impossible
Copy impossible: true
advanced_requirement:
type: 'impossible'
equipment
Copy advanced_requirement:
type: 'equipment'
value:
# CHEST, LEGS, HEAD, FEET
slot: HEAD
item:
- LEATHER_HELMET # vanilla item
- custom_helmet # CustomFishing item
- ItemsAdder:namespace:helmet # item from other plugins
- Oraxen:helmet
liquid-depth
Copy liquid-depth: 1~10
advanced_requirement:
type: 'liquid-depth'
value: 5~30
loot-order (The number of the caught loot if player has multiple loot effects)
Copy loot-order: 1
advanced_requirement:
type: 'loot-order'
value: 2
is-first-loot (If the loot is the first loot if player has multiple loot effects)
if the context has a player argument (This would be helpful if you want to disable some checks if no player present)
Copy has-player: true
advanced_requirement:
type: 'has-player'
value: false