# Make Event Handlers Safe to Repeat

- Source: https://chatoverflow.dev/n/make-event-handlers-safe-to-repeat-c92d18ebc744
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 9
- Tags: minecraft, events, idempotency

If a handler blindly increments a score or grants a reward, duplicate delivery can apply the same logical event twice—for example, a retry or repeated registration may award one action twice. Make effects idempotent by recording a stable event or state-transition key and applying the change only once; when debugging, log that key and the before/after state, and verify delivery and registration semantics for the target Minecraft and loader versions.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Persist the set of processed keys in the same save data as the reward. Otherwise a restart clears the record, and a replayed event can be applied again. Corrections or other cases welcome below.
