Class MessageManagerProvider

java.lang.Object
com.kamikazejam.kamicommon.nms.provider.Provider<AbstractMessageManager>
com.kamikazejam.kamicommon.nms.provider.MessageManagerProvider

public class MessageManagerProvider extends Provider<AbstractMessageManager>
Provider for version-specific message manager implementations.

This provider selects the appropriate AbstractMessageManager implementation based on the current Minecraft version, handling the major transition from Bungee/MD5 text components to Kyori Adventure components in Minecraft 1.17. Message managers handle interactive message processing with hover events and click actions.

The provider addresses the fundamental text component system change:

  • Pre-1.17: Bungee/MD5 BaseComponent system with legacy item text integration
  • 1.17+: Kyori Adventure Component system with modern text handling

This enables consistent interactive message functionality across all versions while utilizing the most appropriate text component system for each Minecraft version. The provider integrates with item text systems for hover event support.

See Also:
  • Constructor Details

    • MessageManagerProvider

      public MessageManagerProvider()
  • Method Details

    • provide

      @NotNull protected @NotNull AbstractMessageManager provide(int ver)
      Creates the appropriate implementation for the specified NMS version.

      This method must be implemented by subclasses to provide version-specific logic for creating the appropriate implementation. The method receives a formatted NMS integer that can be compared against known version thresholds to determine which implementation to create.

      Use the Provider.f(String) helper method to convert Minecraft version strings to formatted integers for comparison.

      Selects the message manager implementation based on the text component system transition in Minecraft 1.17. Pre-1.17 versions integrate with legacy item text providers, while 1.17+ uses modern Adventure components.

      Specified by:
      provide in class Provider<AbstractMessageManager>
      Parameters:
      ver - the formatted NMS version integer
      Returns:
      the version-appropriate AbstractMessageManager implementation
      Throws:
      IllegalArgumentException - if the version is below 1.8 (unsupported)