Skip to content

DSL Conditions

DarkBladeDev edited this page Feb 21, 2026 · 2 revisions

DSL — Conditions

Las condiciones se declaran en event.conditions como un mapa. Cada entrada puede usar un type explícito o asumir el nombre de la key.

Formato recomendado:

event:
  conditions:
    c1:
      type: players_online
      min: 5
    c2:
      type: random_chance
      chance: 0.25

Lista de condiciones por defecto

players_online

- type: players_online
  min: 1

Verdadero si onlinePlayers >= min.

expression

Evalúa una expresión MVEL que debe devolver boolean.

- type: expression
  expression: "players_online > 0 && world_time < 12000"

Variables disponibles: context.getVariables() (ver Variables).

world_time

Verdadero si el tiempo del mundo está en el rango [min, max] (con wrap-around).

- type: world_time
  min: 0
  max: 12000

Valores en ticks de Minecraft (0..23999).

random_chance

- type: random_chance
  chance: 0.25
  • Si chance > 1, se interpreta como porcentaje (ej. 25 → 0.25).

variable_equals

- type: variable_equals
  key: phase
  value: "BOSS"

Compara String.valueOf(context.getVariable(key)) contra value.

is_day / is_night

Usa rangos de tiempo de Minecraft:

  • day: time < 12300 || time >= 23850
  • night: time >= 12300 && time < 23850

is_raining / is_thundering

  • is_raining: world.hasStorm()
  • is_thundering: world.isThundering()

participants_count_gt / participants_count_lt

Basado en context.getParticipants().size().

- type: participants_count_gt
  value: 3

any_participant_has_permission

Verdadero si algún participante online tiene el permiso.

- type: any_participant_has_permission
  permission: "my.perm"

world_difficulty_is

- type: world_difficulty_is
  difficulty: "HARD"

Acepta nombres de org.bukkit.Difficulty (default fallback: NORMAL).

Clone this wiki locally