Asset Events
Packages:
com.hypixel.hytale.assetstore.eventcom.hypixel.hytale.server.core.assetcom.hypixel.hytale.server.core.asset.common.events
Events related to asset loading, management, and asset packs.
LoadAssetEvent
Section titled “LoadAssetEvent”Fired during the asset loading phase.
Class: com.hypixel.hytale.server.core.asset.LoadAssetEvent
| Property | Value |
|---|---|
| Implements | IEvent<Void> |
| Async | No |
| Cancellable | No |
| KeyType | Void |
Priority Constants
Section titled “Priority Constants”| Constant | Value | Description |
|---|---|---|
PRIORITY_LOAD_COMMON | -32 | Early loading priority for common assets |
PRIORITY_LOAD_REGISTRY | -16 | Priority for registry loading |
PRIORITY_LOAD_LATE | 64 | Late loading priority |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getBootStart() | long | Get the boot start timestamp |
isShouldShutdown() | boolean | Check if the server should shutdown due to errors |
getReasons() | List<String> | Get list of failure reasons |
failed(boolean, String) | void | Report a loading failure with optional shutdown flag |
When Fired
Section titled “When Fired”Fired during server startup when assets are being loaded.
LoadedAssetsEvent
Section titled “LoadedAssetsEvent”Fired when assets of a specific type have been loaded. Keyed by asset class.
Class: com.hypixel.hytale.assetstore.event.LoadedAssetsEvent<K, T, M>
| Property | Value |
|---|---|
| Extends | AssetsEvent<K, T> |
| Implements | IEvent<Class<T>> |
| Async | No |
| Cancellable | No |
| KeyType | Class<T> (asset type) |
Type Parameters
Section titled “Type Parameters”K- Asset key typeT extends JsonAsset<K>- Asset typeM extends AssetMap<K, T>- Asset map type
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetClass() | Class<T> | Get the asset class type |
getAssetMap() | M | Get the asset map |
getLoadedAssets() | Map<K, T> | Get unmodifiable map of loaded assets |
isInitial() | boolean | Check if this is the initial load (vs hot-reload) |
getQuery() | AssetUpdateQuery | Get the asset update query |
When Fired
Section titled “When Fired”Fired after assets of a specific type are loaded. Use keyed registration to listen for specific asset types.
Example
Section titled “Example”// listen for CraftingRecipe assetsevents.register(LoadedAssetsEvent.class, CraftingRecipe.class, event -> { for (CraftingRecipe recipe : event.getLoadedAssets().values()) { registerRecipe(recipe); }});
// listen for Item assetsevents.register(LoadedAssetsEvent.class, Item.class, event -> { for (Item item : event.getLoadedAssets().values()) { indexItem(item); }});
// listen for ALL asset types (use sparingly)events.registerGlobal(LoadedAssetsEvent.class, event -> { getLogger().info("Assets loaded: " + event.getLoadedAssets().size());});RemovedAssetsEvent
Section titled “RemovedAssetsEvent”Fired when assets of a specific type are removed. Keyed by asset class.
Class: com.hypixel.hytale.assetstore.event.RemovedAssetsEvent<K, T, M>
| Property | Value |
|---|---|
| Extends | AssetsEvent<K, T> |
| Implements | IEvent<Class<T>> |
| Async | No |
| Cancellable | No |
| KeyType | Class<T> (asset type) |
Type Parameters
Section titled “Type Parameters”K- Asset key typeT extends JsonAsset<K>- Asset typeM extends AssetMap<K, T>- Asset map type
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetClass() | Class<T> | Get the asset class type |
getAssetMap() | M | Get the asset map |
getRemovedAssets() | Set<K> | Get set of removed asset keys |
isReplaced() | boolean | Check if assets were replaced (vs permanently removed) |
When Fired
Section titled “When Fired”Fired when assets are unloaded (hot-reload, asset pack removal, etc.).
Example
Section titled “Example”events.register(RemovedAssetsEvent.class, CraftingRecipe.class, event -> { for (ResourceKey key : event.getRemovedAssets()) { if (!event.isReplaced()) { unregisterRecipe(key); } }});AssetPackRegisterEvent
Section titled “AssetPackRegisterEvent”Fired when an asset pack is registered.
Class: com.hypixel.hytale.server.core.asset.AssetPackRegisterEvent
| Property | Value |
|---|---|
| Implements | IEvent<Void> |
| Async | No |
| Cancellable | No |
| KeyType | Void |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetPack() | AssetPack | Get the asset pack being registered |
When Fired
Section titled “When Fired”Fired when an asset pack (mod content pack) is registered with the server.
AssetPackUnregisterEvent
Section titled “AssetPackUnregisterEvent”Fired when an asset pack is unregistered.
Class: com.hypixel.hytale.server.core.asset.AssetPackUnregisterEvent
| Property | Value |
|---|---|
| Implements | IEvent<Void> |
| Async | No |
| Cancellable | No |
| KeyType | Void |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetPack() | AssetPack | Get the asset pack being unregistered |
When Fired
Section titled “When Fired”Fired when an asset pack is unloaded from the server.
GenerateSchemaEvent
Section titled “GenerateSchemaEvent”Fired during schema generation.
Class: com.hypixel.hytale.server.core.asset.GenerateSchemaEvent
| Property | Value |
|---|---|
| Implements | IEvent<Void> |
| Async | No |
| Cancellable | No |
| KeyType | Void |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getContext() | SchemaContext | Get the schema context |
getVsCodeConfig() | BsonDocument | Get the VS Code configuration document |
addSchemaLink(String, List<String>, String) | void | Add a schema link with file patterns and extension |
addSchema(String, Schema) | void | Add a schema definition |
When Fired
Section titled “When Fired”Fired when asset schemas are being generated (typically during development/tooling).
GenerateAssetsEvent
Section titled “GenerateAssetsEvent”Fired during asset generation. Allows plugins to generate assets programmatically.
Class: com.hypixel.hytale.assetstore.event.GenerateAssetsEvent<K, T, M>
| Property | Value |
|---|---|
| Extends | AssetsEvent<K, T> |
| Implements | IEvent<Class<T>>, IProcessedEvent |
| Async | No |
| Cancellable | No |
| KeyType | Class<T> (asset type) |
Type Parameters
Section titled “Type Parameters”K- Asset key typeT extends JsonAssetWithMap<K, M>- Asset typeM extends AssetMap<K, T>- Asset map type
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetClass() | Class<T> | Get the asset class type |
getLoadedAssets() | Map<K, T> | Get unmodifiable map of currently loaded assets |
getAssetMap() | M | Get the asset map |
addChildAsset(K, T, K) | void | Add a child asset with a single parent |
addChildAsset(K, T, K...) | void | Add a child asset with multiple parents |
addChildAssetWithReference(K, T, Class, Object) | void | Add a child asset referencing a different asset type |
addChildAssetWithReferences(K, T, ParentReference...) | void | Add a child asset with multiple cross-type references |
Inner Classes
Section titled “Inner Classes”ParentReference
Section titled “ParentReference”Helper class for cross-asset-type parent references.
| Method | Return Type | Description |
|---|---|---|
getParentAssetClass() | Class<P> | Get the parent asset class |
getParentKey() | PK | Get the parent asset key |
When Fired
Section titled “When Fired”Fired when procedural assets are being generated.
RegisterAssetStoreEvent
Section titled “RegisterAssetStoreEvent”Fired when an asset store is registered.
Class: com.hypixel.hytale.assetstore.event.RegisterAssetStoreEvent
| Property | Value |
|---|---|
| Extends | AssetStoreEvent<Void> |
| Implements | IEvent<Void> |
| Async | No |
| Cancellable | No |
| KeyType | Void |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetStore() | AssetStore<?, ?, ?> | Get the asset store being registered (inherited from AssetStoreEvent) |
When Fired
Section titled “When Fired”Fired when a new asset store (collection of assets) is registered with the system.
RemoveAssetStoreEvent
Section titled “RemoveAssetStoreEvent”Fired when an asset store is removed.
Class: com.hypixel.hytale.assetstore.event.RemoveAssetStoreEvent
| Property | Value |
|---|---|
| Extends | AssetStoreEvent<Void> |
| Implements | IEvent<Void> |
| Async | No |
| Cancellable | No |
| KeyType | Void |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetStore() | AssetStore<?, ?, ?> | Get the asset store being removed (inherited from AssetStoreEvent) |
When Fired
Section titled “When Fired”Fired when an asset store is unregistered from the system.
AssetStoreMonitorEvent
Section titled “AssetStoreMonitorEvent”Fired when asset store files are changed (hot-reload).
Class: com.hypixel.hytale.assetstore.event.AssetStoreMonitorEvent
| Property | Value |
|---|---|
| Extends | AssetMonitorEvent<Void> |
| Implements | IEvent<Void> |
| Async | No |
| Cancellable | No |
| KeyType | Void |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetStore() | AssetStore<?, ?, ?> | Get the asset store being monitored |
getAssetPack() | String | Get the asset pack name (inherited from AssetMonitorEvent) |
getCreatedOrModifiedFilesToLoad() | List<Path> | Get list of created or modified files to load (inherited) |
getRemovedFilesToUnload() | List<Path> | Get list of removed files to unload (inherited) |
getCreatedOrModifiedDirectories() | List<Path> | Get list of created or modified directories (inherited) |
getRemovedFilesAndDirectories() | List<Path> | Get list of removed files and directories (inherited) |
When Fired
Section titled “When Fired”Fired when the file system monitor detects changes to asset store files.
Use Cases
Section titled “Use Cases”- Custom hot-reload handling
- Asset change logging
- Development tooling
CommonAssetMonitorEvent
Section titled “CommonAssetMonitorEvent”Fired when common asset files are changed.
Class: com.hypixel.hytale.server.core.asset.common.events.CommonAssetMonitorEvent
| Property | Value |
|---|---|
| Extends | AssetMonitorEvent<Void> |
| Implements | IEvent<Void> |
| Async | No |
| Cancellable | No |
| KeyType | Void |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetPack() | String | Get the asset pack name (inherited from AssetMonitorEvent) |
getCreatedOrModifiedFilesToLoad() | List<Path> | Get list of created or modified files to load (inherited) |
getRemovedFilesToUnload() | List<Path> | Get list of removed files to unload (inherited) |
getCreatedOrModifiedDirectories() | List<Path> | Get list of created or modified directories (inherited) |
getRemovedFilesAndDirectories() | List<Path> | Get list of removed files and directories (inherited) |
When Fired
Section titled “When Fired”Fired when common asset files (shared across asset packs) are modified.
SendCommonAssetsEvent
Section titled “SendCommonAssetsEvent”Fired when common assets are sent to a client. Async event.
Class: com.hypixel.hytale.server.core.asset.common.events.SendCommonAssetsEvent
| Property | Value |
|---|---|
| Implements | IAsyncEvent<Void> |
| Async | Yes |
| Cancellable | No |
| KeyType | Void |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getPacketHandler() | PacketHandler | Get the packet handler for the client connection |
getRequestedAssets() | Asset[] | Get the array of assets being sent to the client |
When Fired
Section titled “When Fired”Fired when common assets are being sent to a connecting client.
Abstract Base Classes
Section titled “Abstract Base Classes”AssetStoreEvent
Section titled “AssetStoreEvent”Abstract base class for asset store events.
Class: com.hypixel.hytale.assetstore.event.AssetStoreEvent<KeyType>
| Property | Value |
|---|---|
| Implements | IEvent<KeyType> |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetStore() | AssetStore<?, ?, ?> | Get the asset store associated with this event |
AssetsEvent
Section titled “AssetsEvent”Abstract base class for events related to asset collections.
Class: com.hypixel.hytale.assetstore.event.AssetsEvent<K, T>
| Property | Value |
|---|---|
| Implements | IEvent<Class<T>> |
Type Parameters
Section titled “Type Parameters”K- Asset key typeT extends JsonAsset<K>- Asset type
This is a marker base class with no additional methods beyond those inherited from IEvent.
AssetMonitorEvent
Section titled “AssetMonitorEvent”Abstract base class for file monitoring events.
Class: com.hypixel.hytale.assetstore.event.AssetMonitorEvent<T>
| Property | Value |
|---|---|
| Implements | IEvent<T> |
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getAssetPack() | String | Get the asset pack name |
getCreatedOrModifiedFilesToLoad() | List<Path> | Get list of created or modified files to load |
getRemovedFilesToUnload() | List<Path> | Get list of removed files to unload |
getCreatedOrModifiedDirectories() | List<Path> | Get list of created or modified directories |
getRemovedFilesAndDirectories() | List<Path> | Get list of removed files and directories |