> For the complete documentation index, see [llms.txt](https://docs.marioded.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.marioded.com/api-how-to-guides/examples/milestone.md).

# Recording a milestone

Serialize a custom transient event on the recorder and render it on the player.

**Runtime:** shared payload with role-specific bindings · **Use it for:** a transient game announcement

Follow the [custom recordables guide](/advanced-integrations/recordables.md) for codec registration and seek behavior.

This event announces a milestone during ordinary playback. It is transient, not durable state reconstructed while seeking. Keep the payload/codec contract synchronized across recording and playback machines.

Codec ID `1000` is illustrative, not a reserved extension allocation. Coordinate a free ID with every installed extension and register it before recording or loading data that uses it. Bind each role-specific helper only on a runtime that supplies that role.

{% code title="Milestone.java" %}

```java
package example;

import com.marioded.reverse.api.RecordSession;
import com.marioded.reverse.api.codec.RecordableCodec;
import com.marioded.reverse.api.player.spi.ReversePlayer;
import com.marioded.reverse.api.recorder.spi.ReverseRecorder;
import com.marioded.reverse.api.recordable.Recordable;
import com.marioded.reverse.api.service.RecordableService;

/** Shared transient payload. Coordinate the example codec ID with every installed extension. */
public record Milestone(String text) implements Recordable {
  // Illustrative allocation, not a reserved extension range.
  private static final int CODEC_ID = 1000;
  private static final RecordableCodec<Milestone> CODEC = RecordableCodec.of(
      input -> new Milestone(input.readString()),
      (output, value) -> output.writeString(value.text()));

  public static void registerCodec(RecordableService codecs) {
    codecs.register(CODEC_ID, Milestone.class, CODEC);
  }

  public static void onRecorderEnable(ReverseRecorder recorder) {
    registerCodec(recorder.getRecordableService());
  }

  public static void onPlayerEnable(ReversePlayer player) {
    registerCodec(player.getRecordableService());
    player.getRendererService().register(Milestone.class, (event, context) -> {
      for (org.bukkit.entity.Player viewer : context.getViewers()) {
        viewer.sendMessage(event.text());
      }
    });
  }

  public static void record(ReverseRecorder recorder, RecordSession session, String text) {
    recorder.getRecorderService().insertRecordable(session, new Milestone(text));
  }
}
```

{% endcode %}

Use this payload and its role-specific bindings in your own integration. For persistent entity/block effects, read the durable-state and resynchronization requirements before extending this pattern.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.marioded.com/api-how-to-guides/examples/milestone.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
