Skip to content

LoadAssetEvent

Package: com.hypixel.hytale.server.core.asset Implements: 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.

ConstantTypeValueDescription
PRIORITY_LOAD_COMMONshort-32Priority for loading common assets
PRIORITY_LOAD_REGISTRYshort-16Priority for loading registry assets
PRIORITY_LOAD_LATEshort64Priority for late-stage asset loading
FieldTypeAccessorMutableNullable
bootStartlonggetBootStart()NoNo
reasonsList<String>getReasons()NoNo
shouldShutdownbooleanisShouldShutdown()YesNo
  • 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).

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.

  • HytaleServer.boot() (lines 333-334) via dispatchFor(LoadAssetEvent.class).dispatch(new LoadAssetEvent(...)) — Server boot lifecycle, during asset loading phase.
// Load common assets early
getEventRegistry().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 priority
getEventRegistry().register(LoadAssetEvent.PRIORITY_LOAD_REGISTRY, LoadAssetEvent.class, event -> {
loadRegistryAssets();
});
  • BootEvent — Fired later in the boot sequence after asset loading completes.
  • AssetPackRegisterEvent — Fired when individual asset packs are registered.