ItemsAdderAdditionsItemsAdderAdditions
Behaviours

Contact Effect

Apply effects to players touching a custom block or furniture.

Since v1.0.10

Applies effects to players while they touch or stand on a custom block, furniture, or complex furniture.

Four effect groups are available, all optional. Combine any of them on the same item.

GroupEffect
damageHurt the player on an interval (negative amount heals)
healHeal the player on an interval (negative amount hurts)
potion_effectsRe-apply a list of potion effects while in contact
attributesApply temporary attribute modifiers while in contact

Configuration

behaviours:
  contact_effect:
    damage:
      amount: 1.0
      interval: 20 # optional, default: 20 ticks
      cause: CACTUS # optional, default: CACTUS
      fire_duration: 0 # optional, default: 0 ticks
behaviours:
  contact_effect:
    heal:
      amount: 1.0
      interval: 20 # optional, default: 20 ticks
behaviours:
  contact_effect:
    potion_effects:
      - type: POISON
        duration: 80 # optional, default: 40 ticks
        amplifier: 0 # optional, default: 0 (0 = level 1)
        ambient: false # optional, default: false
        particles: true # optional, default: true
        icon: true # optional, default: true
        interval: 20 # optional, default: 20 ticks
      - type: SLOWNESS
        duration: 80
behaviours:
  contact_effect:
    attributes:
      - attribute: MOVEMENT_SPEED
        amount: 0.05
        operation: ADD_NUMBER # optional, default: ADD_NUMBER
      - attribute: STEP_HEIGHT
        amount: 0.5
behaviours:
  contact_effect:
    apply_when_sneaking: true # optional, default: true
    block_faces: # optional
      top: true # optional, default: true
      north: true # optional, default: true
      south: true # optional, default: true
      west: true # optional, default: true
      east: true # optional, default: true
    damage:
      amount: 1.0
      interval: 40
      cause: CACTUS
    heal:
      amount: 0.5
      interval: 20
    potion_effects:
      - type: SPEED
        amplifier: 1
        duration: 60
        interval: 10
    attributes:
      - attribute: STEP_HEIGHT
        amount: 0.5
        operation: ADD_NUMBER

Damage

KeyTypeDefaultDescription
amountDouble-Half-hearts of damage. Negative values heal instead.
intervalInt20Ticks between each application.
causeStringCACTUSThe damage type, so other plugins can detect the reason.
fire_durationInt0Ticks the player is set on fire when damaged.

For cause, use a value from DamageType (case-insensitive, for example CACTUS, LAVA, MAGIC). An unknown value logs a warning and falls back to CACTUS.

A negative amount heals the player instead of hurting them, clamped to the player's maximum health.

Heal

KeyTypeDefaultDescription
amountDouble-Half-hearts to heal. Negative values deal damage.
intervalInt20Ticks between each application.

Healing never exceeds the player's maximum health. A negative amount deals damage using the CACTUS damage type.

Potion effects

potion_effects is a list. Each entry is re-applied while the player stays in contact.

KeyTypeDefaultDescription
typeString-Required. The potion effect type.
durationInt40Effect duration in ticks.
amplifierInt0Effect level (0 = level 1).
ambientBooleanfalseWhether the effect is ambient.
particlesBooleantrueWhether particles are shown.
iconBooleantrueWhether the HUD icon is shown.
intervalInt20Ticks between each re-application.

For type, use a value from PotionEffectType. An unknown type logs a warning and only that entry is skipped.

Attributes

attributes is a list of temporary attribute modifiers applied while the player is in contact and removed the moment they leave.

KeyTypeDefaultDescription
attributeString-Required. The attribute to modify.
amountDouble-Required. The modifier amount.
operationStringADD_NUMBERHow the amount is applied.

For attribute, use a value from Attribute. The old GENERIC_ and PLAYER_ prefixes are accepted too (for example GENERIC_MOVEMENT_SPEED resolves to MOVEMENT_SPEED).

Valid operation values from AttributeModifier.Operation: ADD_NUMBER, ADD_SCALAR, MULTIPLY_SCALAR_1.

Attribute modifiers are temporary. They are removed automatically when the player leaves the block, quits, or when the plugin reloads or shuts down. Unknown attributes, amounts, or operations log a warning and skip only that entry.

Contact checking

Contact is checked at the lowest interval needed by any interval-based effect (damage, heal, and each potion_effects entry). Each effect keeps its own cooldown, so different intervals stay independent.

If any attributes are configured, contact is checked every tick so modifiers are removed promptly when the player steps off the block.

Shared options

KeyTypeDefaultDescription
apply_when_sneakingBooleantrueWhether effects apply while the player is sneaking.
block_facesSectionall onWhich faces count as contact (top, north, south, west, east).

On this page