Class MagicUtilsConsumerRegistry
java.lang.Object
dev.ua.theroer.magicutils.platform.MagicUtilsConsumerRegistry
Process-wide registry of mods/plugins currently using the shared MagicUtils
runtime. On loaders where every consumer shares one classloader (Fabric,
NeoForge) this is a plain static holder: the platform bootstrap registers each
consuming mod here on startup, and the standalone bundle command reads
snapshots from it. Bukkit keeps its own registry (separate plugin classloaders
+ a reflective bridge to the bundle plugin), but shares the
MagicUtilsConsumerInfo snapshot type.
Registrations keep a live MagicUtilsConsumerRuntimeView rather than a
frozen MagicUtilsConsumerInfo. The consumer's command/component counts
change after registration (commands are wired on server start, components while
the runtime is built), so snapshot() / find(String) rebuild a
fresh MagicUtilsConsumerInfo from the view at call time. This keeps
/magicutils mods honest instead of showing an early snapshot.
This is the single implementation the per-loader registries delegate to, so the holder logic is not duplicated across platforms.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordImmutable static metadata of a consumer, captured once at registration. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable MagicUtilsConsumerInfoConsumer matchingmodNameignoring case, rebuilt from its live view, or null.static voidRegisters or refreshes a consumer from an already-builtinfo.static voidRegisters or refreshes a consumer from its staticmetaplus a liveview.static List<MagicUtilsConsumerInfo> snapshot()Immutable, name-sorted snapshot of the registered consumers, rebuilt from live views.static voidunregister(@Nullable String modName) Removes the consumer registered undermodName, if any.
-
Method Details
-
register
public static void register(MagicUtilsConsumerRegistry.StaticMeta meta, MagicUtilsConsumerRuntimeView view) Registers or refreshes a consumer from its staticmetaplus a liveview. The view is read lazily on everysnapshot()/find(String), so callers should pass a view backed by the live runtime rather than a captured snapshot. -
register
Registers or refreshes a consumer from an already-builtinfo. The dynamic fields are frozen at the value they held ininfo; preferregister(StaticMeta, MagicUtilsConsumerRuntimeView)where a live view is available. Kept for bridges that can only produce a snapshot. -
unregister
Removes the consumer registered undermodName, if any. -
snapshot
Immutable, name-sorted snapshot of the registered consumers, rebuilt from live views. -
find
Consumer matchingmodNameignoring case, rebuilt from its live view, or null.
-