Описание
# ConditionsMod
ConditionsMod is a Minecraft mod that lets you create fully customizable events using simple YAML files, without writing code.
It is inspired by ConditionalEvents, but it is built with a stronger goal: to provide a cleaner, faster, lighter, and more flexible event system for modern modded servers. ConditionsMod keeps the familiar event-condition-action workflow while improving the configuration experience, runtime performance, and extensibility.
The project is designed for Forge and Fabric ports, depending on the Minecraft version.
## How It Works
ConditionsMod follows a simple flow:
`Event -> Conditions -> Actions`
- `Event`: detects something happening in the game.
- `Conditions`: checks whether requirements are met.
- `Actions`: runs the result if the conditions pass.
This lets you build custom server behavior without creating a separate mod or writing Java code.
## YAML Configuration
Events are configured with `.yml` files.
```text
Server: conditions/
Client: config/conditions/
```
Example:
```yaml
events:
- name: welcome
type: player_join
enabled: true
conditions: []
actions:
default:
- "message: &aWelcome, %player%!"
```
## ConditionalEvents Compatibility
ConditionsMod supports ConditionalEvents-style configuration so server owners can migrate many existing setups without rewriting everything.
Supported compatibility features include:
- `Events:` root section.
- Native `events:` list format.
- Text conditions such as `%main_command% == /hello`.
- Conditional action branches with `execute`.
- Compound conditions with `and` and `or`.
- Action groups such as `default`, `cooldown`, `one_time`, and custom groups.
- Targeted actions such as `to_all`, `to_target`, `to_world`, `to_player`, and `to_range`.
- Common variables such as `%player%`, `%main_command%`, `%args_length%`, `%arg_1%`, `%block%`, `%playerblock_inside%`, `%playerblock_below_1%`, `%playerblock_above_1%`, `%random_1_10%`, `%random_last%`, `%world_time%`, cooldown variables, and SVR variables.
Example using ConditionalEvents-style layout:
```yaml
Events:
command_example:
type: player_command
conditions:
- "%main_command% == /announce"
- "%args_length% == 0 execute error"
actions:
default:
- "to_all: centered_message: &c&lAnnouncement"
- "to_all: message: &e%player%&7: %args_substring_1-100%"
error:
- "message: &cUse /announce "
```
## What ConditionsMod Improves
ConditionsMod is made to go beyond the traditional ConditionalEvents approach:
- YAML-first configuration that is easier to read and maintain.
- Lightweight runtime focused on checking only what is needed.
- Fast event lookup by name for calls, enable/disable commands, and debug tools.
- Events grouped by type, reducing unnecessary checks.
- Cached regex conditions for better repeated-condition performance.
- Concurrent runtime state for cooldowns and one-time event tracking.
- Cleaner addon API for custom actions, placeholders, variables, and custom events.
- Client-side features that traditional server-only plugins cannot provide, such as HUD, camera, key blocking, and key combos.
- A simpler core that avoids loading large plugin-style systems when they are not needed.
## Event Types
ConditionsMod includes event types for:
- Player join, leave, death, kill, chat, command, respawn, teleport, damage, sneak, jump, inventory, stats, food, air, and more.
- Block break, place, and interact.
- Item interact, consume, pickup, drop, craft, enchant, repair, move, and select.
- Entity interact and spawn.
- Server start, stop, repetitive server checks, custom events, and call events.
- Client features such as HUD display, camera, key, and key combo events.
## Conditions
Conditions support common operators:
```text
==, !=, equals, !equals
equalsIgnoreCase, !equalsIgnoreCase
contains, !contains
startsWith, !startsWith
endsWith, !endsWith
matches, !matches
>, >=, Acciones`
- `Evento`: detecta algo que ocurre en el juego.
- `Condiciones`: comprueban si se cumplen los requisitos.
- `Acciones`: ejecutan la respuesta cuando las condiciones pasan.
Con esto puedes crear sistemas completos sin hacer otro mod y sin escribir código Java.
## Configuración YAML
Los eventos se configuran con archivos `.yml`.
```text
Servidor: conditions/
Cliente: config/conditions/
```
Ejemplo:
```yaml
events:
- name: bienvenida
type: player_join
enabled: true
conditions: []
actions:
default:
- "message: &aBienvenido, %player%!"
```
## Compatibilidad Con ConditionalEvents
ConditionsMod soporta el estilo de configuración de ConditionalEvents para que los usuarios puedan migrar muchas configs sin rehacer todo desde cero.
Compatibilidad incluida:
- Sección raíz `Events:`.
- Formato nativo `events:`.
- Condiciones de texto como `%main_command% == /hello`.
- Ramas condicionales con `execute`.
- Condiciones compuestas con `and` y `or`.
- Grupos de acciones como `default`, `cooldown`, `one_time` y grupos personalizados.
- Acciones dirigidas como `to_all`, `to_target`, `to_world`, `to_player` y `to_range`.
- Variables comunes como `%player%`, `%main_command%`, `%args_length%`, `%arg_1%`, `%block%`, `%playerblock_inside%`, `%playerblock_below_1%`, `%playerblock_above_1%`, `%random_1_10%`, `%random_last%`, `%world_time%`, variables de cooldown y variables SVR.
Ejemplo con formato estilo ConditionalEvents:
```yaml
Events:
comando_anuncio:
type: player_command
conditions:
- "%main_command% == /anuncio"
- "%args_length% == 0 execute error"
actions:
default:
- "to_all: centered_message: &c&lAnuncio"
- "to_all: message: &e%player%&7: %args_substring_1-100%"
error:
- "message: &cUsa /anuncio "
```
## Qué Mejora ConditionsMod
ConditionsMod está hecho para mejorar la experiencia frente al enfoque clásico de ConditionalEvents:
- Configuración YAML más clara y fácil de editar.
- Sistema más ligero, pensado para ejecutar solo lo necesario.
- Búsqueda rápida de eventos por nombre para `call_event`, comandos de enable/disable y debug.
- Eventos agrupados por tipo para reducir comprobaciones innecesarias.
- Regex cacheadas para mejorar condiciones repetidas.
- Estados runtime concurrentes para cooldowns y eventos de una sola vez.
- API más limpia para addons, acciones custom, placeholders, variables y eventos custom.
- Funciones de cliente que un plugin solo de servidor no puede ofrecer, como HUD, cámara, bloqueo de teclas y combinaciones de teclas.
- Núcleo más simple, evitando cargar sistemas grandes cuando no hacen falta.
## Tipos De Eventos
ConditionsMod incluye eventos para:
- Jugadores: entrar, salir, morir, matar, chat, comandos, respawn, teleport, daño, sneak, salto, inventario, estadísticas, comida, aire y más.
- Bloques: romper, colocar e interactuar.
- Items: interactuar, consumir, recoger, tirar, craftear, encantar, reparar, mover y seleccionar.
- Entidades: interactuar y spawn.
- Servidor: inicio, apagado, eventos repetitivos de servidor, eventos custom y eventos call.
- Cliente: HUD, cámara, teclas y combinaciones de teclas.
## Condiciones
Las condiciones soportan operadores comunes:
```text
==, !=, equals, !equals
equalsIgnoreCase, !equalsIgnoreCase
contains, !contains
startsWith, !startsWith
endsWith, !endsWith
matches, !matches
>, >=,