Skip to content
On this page
Fabric

FabricManagedEvents

top.katton.api.event.managedfabric/src/main/kotlin/top/katton/api/event/managed/FabricManagedEvents.kt
Fabric implementation of [ManagedListenerProvider].

FabricManagedEvents ​

FabricManagedEventsFabricObject
kotlin
object FabricManagedEvents

Fabric implementation of [ManagedListenerProvider].

Fabric's event system ([Event]) does not support individual callback unregistration. To work around this, each managed listener wraps the user callback in a dynamic proxy with an active flag. On reload, all WORLD/SERVER_CACHE-scoped wrappers are deactivated.

Initialized once in [KattonFabric.onInitialize] via [initialize].

FabricManagedEvents.FabricListenerState ​

FabricManagedEvents.FabricListenerStateFabricClass
kotlin
class FabricListenerState(@Volatile var callback: Any?

The Fabric event permanently owns the proxy, so the proxy may only retain this small host-loaded state object. Clearing [callback] releases the old script lambda and its classloader even though Fabric cannot remove the proxy itself.