Skip to content

Plugin Registries

Hytale provides a registry system for plugins to register their components, events, commands, and other features. All registries are accessed through your plugin’s base class and automatically handle cleanup when your plugin is disabled.

  • Plugin base: com.hypixel.hytale.server.core.plugin.PluginBase
  • Component registry: com.hypixel.hytale.component.ComponentRegistryProxy
  • Event registry: com.hypixel.hytale.event.EventRegistry
  • Command registry: com.hypixel.hytale.server.core.command.system.CommandRegistry

The following registries are available:

RegistryMethodPurpose
Command RegistrygetCommandRegistry()Register commands
Event RegistrygetEventRegistry()Register event listeners
Entity Store RegistrygetEntityStoreRegistry()Register entity ECS components/systems
Chunk Store RegistrygetChunkStoreRegistry()Register chunk ECS components/systems
Block State RegistrygetBlockStateRegistry()Register custom block states
Entity RegistrygetEntityRegistry()Register entity types
Task RegistrygetTaskRegistry()Register scheduled tasks
Asset RegistrygetAssetRegistry()Register asset types
Client Feature RegistrygetClientFeatureRegistry()Register client feature flags
Codec RegistrygetCodecRegistry(codec)Register to codec maps

For method tables, code examples, and details on each registry, see Existing Registries.

In addition to registries, your plugin has access to these utility methods:

HytaleLogger logger = getLogger();
logger.at(Level.INFO).log("Plugin loaded!");
logger.at(Level.WARNING).log("Something might be wrong");
logger.at(Level.SEVERE).withCause(exception).log("Error occurred: %s", message);
Path dataDir = getDataDirectory();
Path configFile = dataDir.resolve("custom-data.json");
PluginIdentifier id = getIdentifier();
String fullId = id.toString(); // "Group/Name"
PluginManifest manifest = getManifest();
String version = manifest.getVersion();
String description = manifest.getDescription();
String basePerm = getBasePermission(); // "group.name"
String myPerm = basePerm + ".myfeature"; // "group.name.myfeature"
if (isEnabled()) {
// plugin is active (SETUP, START, or ENABLED states)
}
if (isDisabled()) {
// plugin is in NONE, SHUTDOWN, or DISABLED state
}
PluginState state = getState();

All registrations are automatically cleaned up when your plugin shuts down, in reverse order of registration (LIFO). You don’t need to manually unregister event listeners, commands, ECS components, tasks, or codec registrations.

For details on the cleanup mechanism and shutdownAndCleanup(), see Creating Registries.

  1. Register in setup(): Perform all registrations in the setup() method
  2. Store references: Keep references to component/resource types for later use
  3. Use appropriate priorities: Choose event priorities based on your needs
  4. Let cleanup happen automatically: Don’t manually unregister unless necessary