Capture, assert, and inspect events with EventAssert and EventCapture during test execution.
Events are a core communication mechanism in Hytale server plugins. HRTK lets you capture events fired during a test and assert on their occurrence, count, and contents using EventAssert and EventCapture.
Use TestContext.captureEvent() to start recording events of a specific type. The returned EventCapture<E> accumulates all matching events until you call close() or the test ends.
HRTK’s event capture system registers listeners at the server level. This means:
Captured events include both cancelled and non-cancelled events (depending on listener priority)
Your test can observe events that other plugins may cancel
The capture does not interfere with normal event processing
Always call capture.close() when you are done to unregister the listener. If you forget, HRTK will close all open captures automatically when the suite finishes, but it is best practice to close them explicitly.