Skip to content

Conditions ​

Condition files live under conditions/*.yml. A condition file covers the fields of a condition group, the entry types you can use, and the variables available in condition expressions. They define PDC read rules that decide whether an item's attribute payload activates, and you can reference them for equipment restrictions, recipe restrictions, skill restrictions, and cross-module checks. Note that some bundled examples ship with enabled: false and must be enabled deliberately

Condition group fields ​

FieldTypeDefaultDescription
enabledbooleantrueWhether this condition group is loaded. Disabled files are skipped
source_idstring—Source id this rule applies to. Required when enabled
condition.typestringall_ofHow entries are combined
condition.required_countinteger1Number of entries that must pass when condition.type is at_least or exactly. An unconfigured value resolves to 1 at evaluation time
condition.invalid_as_failurebooleantrueWhether a malformed or unevaluable condition counts as failure
condition.entrieslist[]Condition entries

condition.type values ​

ValueDescription
all_ofEvery entry must pass
any_ofAt least one entry must pass
at_leastAt least required_count entries must pass
exactlyExactly required_count entries must pass
none_ofNo entry may pass

Entry types ​

TypeDescription
pdc_metaCheck a value in the payload's meta map
lore_regexMatch item lore with a regular expression
pdc_attributeCheck an attribute value inside the payload
source_idCheck the payload's source id

pdc_meta and pdc_attribute entries require a key. lore_regex entries require a pattern, which must be a valid regular expression. A checks field is not supported and makes the file fail validation

pdc_meta entry ​

FieldDescription
typepdc_meta
keyMeta key to read
conditionComparison expression

lore_regex entry ​

FieldDescription
typelore_regex
patternRegular expression; matched case-insensitively with Unicode support
require_matchWhether a match is required
conditionComparison expression, may use capture groups

pdc_attribute entry ​

FieldDescription
typepdc_attribute
keyAttribute id
conditionComparison expression

source_id entry ​

FieldDescription
typesource_id
conditionComparison expression checking the payload's source id

Built-in expression variables ​

In the condition field you can use these variables:

VariableDescription
%value%Current field value (the pdc_meta key value, or the pdc_attribute attribute value). lore_regex is the exception: there it receives the whole matched lore line, not a capture group, so a numeric comparison such as %value% <= %player_level% does not work. Use $1 instead
$0, $1, $2, ...Regex capture groups, available in lore_regex entries. $0 is the whole match, $1 onward are the capture groups. Use these to read numbers under lore_regex
%source_meta_<key>%A value from the payload's meta map
%source_attribute_<key>%A value from the payload's attributes map
%source_id%The payload's source id
%player_name%Player name
%player_level%Player experience level

NOTE

When PlaceholderAPI is installed, its placeholders can also be used in condition expressions

Example: PDC meta condition ​

yaml
enabled: true
source_id: forge
condition:
  type: all_of
  invalid_as_failure: true
  entries:
    - type: pdc_meta
      key: required_level
      condition: '%value% <= %player_level%'

Example: attribute value condition ​

yaml
enabled: true
source_id: equipment_check
condition:
  type: all_of
  entries:
    - type: pdc_attribute
      key: physical_attack
      condition: '%value% >= 50'

Example: source match condition ​

yaml
enabled: true
source_id: strengthen
condition:
  type: all_of
  entries:
    - type: source_id
      condition: '%source_id% == "strengthen"'

Example: lore regex condition ​

yaml
enabled: true
source_id: legacy_weapon
condition:
  type: any_of
  invalid_as_failure: true
  entries:
    - type: lore_regex
      pattern: '.*Weapon Level: (\d+).*'
      require_match: true
      condition: '$1 >= 20'

Example: at least N conditions ​

yaml
enabled: true
source_id: multi_check
condition:
  type: at_least
  required_count: 2
  entries:
    - type: pdc_meta
      key: enchant_level
      condition: '%value% >= 3'
    - type: pdc_meta
      key: quality
      condition: '%value% == "epic"'
    - type: pdc_attribute
      key: physical_attack
      condition: '%value% >= 100'

Bundled condition files ​

Filesource_idDescription
strengthen.ymlstrengthenStrengthen source
forge.ymlforgeForge source; checks required_level <= player_level
emakiitem.ymlemakiitemItem source; checks condition_expressions
default_bind.ymlgem_bindSoul-bind check on bound_player == player_name. Disabled by default
default_equipment_level.ymlgem_equipment_levelEquipment level check via lore_regex. Disabled by default

After you edit condition files, run /ea lint first so schema problems (a missing source_id, an unsupported checks field, an invalid condition type, a missing key / pattern, a broken regex) surface before you reload