LoadAssetEvent
Package:
com.hypixel.hytale.server.core.assetImplements:IEvent<Void>Cancellable: No
Standard event dispatched during the server boot lifecycle, specifically during the asset loading phase. Listeners registered at different priority levels load assets in a defined order using the static priority constants. If a listener encounters a failure, it can call failed(boolean, String) to signal the failure and optionally request server shutdown.
Static Constants
Section titled “Static Constants”| Constant | Type | Value | Description |
|---|---|---|---|
PRIORITY_LOAD_COMMON | short | -32 | Priority for loading common assets |
PRIORITY_LOAD_REGISTRY | short | -16 | Priority for loading registry assets |
PRIORITY_LOAD_LATE | short | 64 | Priority for late-stage asset loading |
Fields / Accessors
Section titled “Fields / Accessors”| Field | Type | Accessor | Mutable | Nullable |
|---|---|---|---|---|
bootStart | long | getBootStart() | No | No |
reasons | List<String> | getReasons() | No | No |
shouldShutdown | boolean | isShouldShutdown() | Yes | No |
- bootStart — Timestamp of when the server boot started.
- reasons — List of failure reason strings accumulated during the asset loading phase. Initially empty.
- shouldShutdown — Whether the server should shut down due to asset loading failures. Mutable indirectly via
failed(boolean, String).
Methods
Section titled “Methods”failed(boolean shouldShutdown, String reason)
Section titled “failed(boolean shouldShutdown, String reason)”Signals that an asset loading failure occurred. The shouldShutdown flag is OR-ed with the existing value (once true, stays true). The reason string is added to the reasons list.
Fired By
Section titled “Fired By”HytaleServer.boot()(lines 333-334) viadispatchFor(LoadAssetEvent.class).dispatch(new LoadAssetEvent(...))— Server boot lifecycle, during asset loading phase.
Listening
Section titled “Listening”// Load common assets earlygetEventRegistry().register(LoadAssetEvent.PRIORITY_LOAD_COMMON, LoadAssetEvent.class, event -> { try { loadCommonAssets(); } catch (Exception e) { event.failed(true, "Failed to load common assets: " + e.getMessage()); }});
// Load registry assets at standard prioritygetEventRegistry().register(LoadAssetEvent.PRIORITY_LOAD_REGISTRY, LoadAssetEvent.class, event -> { loadRegistryAssets();});Related Events
Section titled “Related Events”BootEvent— Fired later in the boot sequence after asset loading completes.AssetPackRegisterEvent— Fired when individual asset packs are registered.