Condition

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

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

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

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)

time:
  - 0~1000
  - 2000~6000

advanced_requirement:
  type: time
  value:
  - 0~1000
  - 2000~6000

ypos (Player's Y coordinate)

ypos:
  - 0~43
  - -45~12
  
advanced_requirement:
  type: ypos
  value:
  - 0~43
  - -45~12

in-lava (If the fishhook is in lava)

in-lava: true

advanced_requirement:
  type: in-lava
  value: true

in-water (If the fishhook is in water)

in-water: true

advanced_requirement:
  type: in-water
  value: true

in-void (If the fishhook is in void)

in-void: true

advanced_requirement:
  type: in-void
  value: true

ice-fishing (If the fishhook is in a frozen river)

ice-fishing: true

advanced_requirement:
  type: ice-fishing
  value: true

open-water (If the fishhook is in open water)

open-water: true

advanced_requirement:
  type: open-water
  value: true

biome (Supports custom biomes)

biome:
  - minecraft:plains  <- whitelist

'!biome':
  - minecraft:plains  <- blacklist

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 (requires WorldGuard)

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

weather:
  - thunder
  - clear
  - rain

advanced_requirement:
  type: 'weather'
  value:
  - thunder
  - clear
  - rain

date (Real life 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 (Requires RealisticSeasons/CustomCrops)

season:
  - summer
  - spring
  - autumn
  - winter

advanced_requirement:
  type: 'season'
  value:
  - summer
  - spring
  - autumn
  - winter

“>” “>=” “<” “<=” “==” “!=” (For numbers)

'==':
  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'  <- 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

rod:
  - starter_rod

'!rod':
  - FISHING_ROD  <- vanilla 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 (This can be used in game conditions)

loot:
  - tuna_fish

advanced_requirement:
  type: '!loot'
  value:
    - shark

plugin-level

plugin-level:
  plugin: mcMMO
  level: 10
  target: FISHING

logic (Create complex conditions)

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)

level: 10

advanced_requirement:
  type: 'level'
  value: 10

random (0~1)

random: 0.3   <- 30% chance

advanced_requirement:
  type: 'random'
  value: 0.7   <- 70% chance

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 (whether item is in fishing bag)

in-bag: false

advanced_requirement:
  type: 'in-bag'
  value: true

competition (If there's a competition going on)

competition:
  ongoing: true
  id:  <- optional
    - 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": 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)

has-stats: true

advanced_requirement:
  type: 'has-stats'
  value: "true

has-size (If a loot is item type and has size property)

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"

advanced_requirement:
  type: 'moon-phase'
  value:
    - full_moon

impossible

impossible: true

advanced_requirement:
  type: 'impossible'

equipment

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

liquid-depth: 1~10

advanced_requirement:
  type: 'liquid-depth'
  value: 5~30

Last updated