Conditions
A condition restricts when an objective’s progress is allowed to count. Conditions are optional; without any, every qualifying action ticks the objective.
In reality, conditions are not special in themselves: they are just regular objective properties that have been abstracted out of objective-type-specific fields whenever I see these properties have the potential to apply to multiple current and future objective types. For example, instead of having all objective types have a TimeOfDay field that restricts progress to a certain time, the TimeOfDayCondition can be applied to any objective type to achieve the same effect with no additional implementation work needed from the objective type (even the ones that don’t exist yet!).
While any condition can be attached to any objective type, a condition only takes effect when the objective’s event actually provides the necessary data the condition needs. If it doesn’t, the condition is silently ignored and the objective progresses as if it weren’t there. The plugin won’t stop you from attaching conditions that don’t apply, so check that yours make sense for the objective. If a condition you attach isn’t working and you think it should, you can share it in the Discord server!
Attaching conditions
Section titled “Attaching conditions”Conditions live in an objective’s conditions map. Progress ticks only when
the objective’s main requirement AND every attached condition are met. For
example, a Kill objective with a
Time of Day condition only counts kills
made at night.
{ "type": "Kill", "amountRequired": 5, "entities": ["animal_bear"], "conditions": { "at_night": { "type": "TimeOfDay", "startTime": "20:00", "endTime": "06:00" } }}Each entry’s key is a unique id you choose. The web editor will generate one for you, but I recommend giving it a descriptive name so it’s easier to identify when debugging.
Combining conditions
Section titled “Combining conditions”Three logical conditions let you build more complex rules by nesting other conditions inside them. They can nest within each other to any depth.
Every nested condition must hold. Nested conditions go in a conditions map.
{ "type": "And", "conditions": { "a": { "...": "" }, "b": { "...": "" } } }At least one nested condition must hold.
{ "type": "Or", "conditions": { "a": { "...": "" }, "b": { "...": "" } } }Negates a single nested condition (note the singular condition key, not
conditions).
{ "type": "Not", "condition": { "type": "Weapon", "weapon": ["bow.hunting"] } }