Skip to content

Asset Events

Packages:

  • com.hypixel.hytale.assetstore.event
  • com.hypixel.hytale.server.core.asset
  • com.hypixel.hytale.server.core.asset.common.events

Events related to asset loading, management, and asset packs.


Fired during the asset loading phase.

Class: com.hypixel.hytale.server.core.asset.LoadAssetEvent

PropertyValue
ImplementsIEvent<Void>
AsyncNo
CancellableNo
KeyTypeVoid
ConstantValueDescription
PRIORITY_LOAD_COMMON-32Early loading priority for common assets
PRIORITY_LOAD_REGISTRY-16Priority for registry loading
PRIORITY_LOAD_LATE64Late loading priority
MethodReturn TypeDescription
getBootStart()longGet the boot start timestamp
isShouldShutdown()booleanCheck if the server should shutdown due to errors
getReasons()List<String>Get list of failure reasons
failed(boolean, String)voidReport a loading failure with optional shutdown flag

Fired during server startup when assets are being loaded.


Fired when assets of a specific type have been loaded. Keyed by asset class.

Class: com.hypixel.hytale.assetstore.event.LoadedAssetsEvent<K, T, M>

PropertyValue
ExtendsAssetsEvent<K, T>
ImplementsIEvent<Class<T>>
AsyncNo
CancellableNo
KeyTypeClass<T> (asset type)
  • K - Asset key type
  • T extends JsonAsset<K> - Asset type
  • M extends AssetMap<K, T> - Asset map type
MethodReturn TypeDescription
getAssetClass()Class<T>Get the asset class type
getAssetMap()MGet the asset map
getLoadedAssets()Map<K, T>Get unmodifiable map of loaded assets
isInitial()booleanCheck if this is the initial load (vs hot-reload)
getQuery()AssetUpdateQueryGet the asset update query

Fired after assets of a specific type are loaded. Use keyed registration to listen for specific asset types.

// listen for CraftingRecipe assets
events.register(LoadedAssetsEvent.class, CraftingRecipe.class, event -> {
for (CraftingRecipe recipe : event.getLoadedAssets().values()) {
registerRecipe(recipe);
}
});
// listen for Item assets
events.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());
});

Fired when assets of a specific type are removed. Keyed by asset class.

Class: com.hypixel.hytale.assetstore.event.RemovedAssetsEvent<K, T, M>

PropertyValue
ExtendsAssetsEvent<K, T>
ImplementsIEvent<Class<T>>
AsyncNo
CancellableNo
KeyTypeClass<T> (asset type)
  • K - Asset key type
  • T extends JsonAsset<K> - Asset type
  • M extends AssetMap<K, T> - Asset map type
MethodReturn TypeDescription
getAssetClass()Class<T>Get the asset class type
getAssetMap()MGet the asset map
getRemovedAssets()Set<K>Get set of removed asset keys
isReplaced()booleanCheck if assets were replaced (vs permanently removed)

Fired when assets are unloaded (hot-reload, asset pack removal, etc.).

events.register(RemovedAssetsEvent.class, CraftingRecipe.class, event -> {
for (ResourceKey key : event.getRemovedAssets()) {
if (!event.isReplaced()) {
unregisterRecipe(key);
}
}
});

Fired when an asset pack is registered.

Class: com.hypixel.hytale.server.core.asset.AssetPackRegisterEvent

PropertyValue
ImplementsIEvent<Void>
AsyncNo
CancellableNo
KeyTypeVoid
MethodReturn TypeDescription
getAssetPack()AssetPackGet the asset pack being registered

Fired when an asset pack (mod content pack) is registered with the server.


Fired when an asset pack is unregistered.

Class: com.hypixel.hytale.server.core.asset.AssetPackUnregisterEvent

PropertyValue
ImplementsIEvent<Void>
AsyncNo
CancellableNo
KeyTypeVoid
MethodReturn TypeDescription
getAssetPack()AssetPackGet the asset pack being unregistered

Fired when an asset pack is unloaded from the server.


Fired during schema generation.

Class: com.hypixel.hytale.server.core.asset.GenerateSchemaEvent

PropertyValue
ImplementsIEvent<Void>
AsyncNo
CancellableNo
KeyTypeVoid
MethodReturn TypeDescription
getContext()SchemaContextGet the schema context
getVsCodeConfig()BsonDocumentGet the VS Code configuration document
addSchemaLink(String, List<String>, String)voidAdd a schema link with file patterns and extension
addSchema(String, Schema)voidAdd a schema definition

Fired when asset schemas are being generated (typically during development/tooling).


Fired during asset generation. Allows plugins to generate assets programmatically.

Class: com.hypixel.hytale.assetstore.event.GenerateAssetsEvent<K, T, M>

PropertyValue
ExtendsAssetsEvent<K, T>
ImplementsIEvent<Class<T>>, IProcessedEvent
AsyncNo
CancellableNo
KeyTypeClass<T> (asset type)
  • K - Asset key type
  • T extends JsonAssetWithMap<K, M> - Asset type
  • M extends AssetMap<K, T> - Asset map type
MethodReturn TypeDescription
getAssetClass()Class<T>Get the asset class type
getLoadedAssets()Map<K, T>Get unmodifiable map of currently loaded assets
getAssetMap()MGet the asset map
addChildAsset(K, T, K)voidAdd a child asset with a single parent
addChildAsset(K, T, K...)voidAdd a child asset with multiple parents
addChildAssetWithReference(K, T, Class, Object)voidAdd a child asset referencing a different asset type
addChildAssetWithReferences(K, T, ParentReference...)voidAdd a child asset with multiple cross-type references

Helper class for cross-asset-type parent references.

MethodReturn TypeDescription
getParentAssetClass()Class<P>Get the parent asset class
getParentKey()PKGet the parent asset key

Fired when procedural assets are being generated.


Fired when an asset store is registered.

Class: com.hypixel.hytale.assetstore.event.RegisterAssetStoreEvent

PropertyValue
ExtendsAssetStoreEvent<Void>
ImplementsIEvent<Void>
AsyncNo
CancellableNo
KeyTypeVoid
MethodReturn TypeDescription
getAssetStore()AssetStore<?, ?, ?>Get the asset store being registered (inherited from AssetStoreEvent)

Fired when a new asset store (collection of assets) is registered with the system.


Fired when an asset store is removed.

Class: com.hypixel.hytale.assetstore.event.RemoveAssetStoreEvent

PropertyValue
ExtendsAssetStoreEvent<Void>
ImplementsIEvent<Void>
AsyncNo
CancellableNo
KeyTypeVoid
MethodReturn TypeDescription
getAssetStore()AssetStore<?, ?, ?>Get the asset store being removed (inherited from AssetStoreEvent)

Fired when an asset store is unregistered from the system.


Fired when asset store files are changed (hot-reload).

Class: com.hypixel.hytale.assetstore.event.AssetStoreMonitorEvent

PropertyValue
ExtendsAssetMonitorEvent<Void>
ImplementsIEvent<Void>
AsyncNo
CancellableNo
KeyTypeVoid
MethodReturn TypeDescription
getAssetStore()AssetStore<?, ?, ?>Get the asset store being monitored
getAssetPack()StringGet 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)

Fired when the file system monitor detects changes to asset store files.

  • Custom hot-reload handling
  • Asset change logging
  • Development tooling

Fired when common asset files are changed.

Class: com.hypixel.hytale.server.core.asset.common.events.CommonAssetMonitorEvent

PropertyValue
ExtendsAssetMonitorEvent<Void>
ImplementsIEvent<Void>
AsyncNo
CancellableNo
KeyTypeVoid
MethodReturn TypeDescription
getAssetPack()StringGet 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)

Fired when common asset files (shared across asset packs) are modified.


Fired when common assets are sent to a client. Async event.

Class: com.hypixel.hytale.server.core.asset.common.events.SendCommonAssetsEvent

PropertyValue
ImplementsIAsyncEvent<Void>
AsyncYes
CancellableNo
KeyTypeVoid
MethodReturn TypeDescription
getPacketHandler()PacketHandlerGet the packet handler for the client connection
getRequestedAssets()Asset[]Get the array of assets being sent to the client

Fired when common assets are being sent to a connecting client.


Abstract base class for asset store events.

Class: com.hypixel.hytale.assetstore.event.AssetStoreEvent<KeyType>

PropertyValue
ImplementsIEvent<KeyType>
MethodReturn TypeDescription
getAssetStore()AssetStore<?, ?, ?>Get the asset store associated with this event

Abstract base class for events related to asset collections.

Class: com.hypixel.hytale.assetstore.event.AssetsEvent<K, T>

PropertyValue
ImplementsIEvent<Class<T>>
  • K - Asset key type
  • T extends JsonAsset<K> - Asset type

This is a marker base class with no additional methods beyond those inherited from IEvent.


Abstract base class for file monitoring events.

Class: com.hypixel.hytale.assetstore.event.AssetMonitorEvent<T>

PropertyValue
ImplementsIEvent<T>
MethodReturn TypeDescription
getAssetPack()StringGet 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