Class ItemEditorProvider

java.lang.Object
com.kamikazejam.kamicommon.nms.provider.Provider<AbstractItemEditor>
com.kamikazejam.kamicommon.nms.provider.ItemEditorProvider

public class ItemEditorProvider extends Provider<AbstractItemEditor>
Provider for version-specific item editor implementations.

This provider selects the appropriate AbstractItemEditor implementation based on the current Minecraft version, handling the introduction of new item properties and metadata systems. Item editors provide advanced ItemMeta manipulation capabilities that extend beyond standard Bukkit API functionality.

The provider addresses the introduction of new item features:

  • 1.8-1.10: Basic item metadata with limited unbreakable support
  • 1.11+: Enhanced item properties including proper unbreakable flags

This enables consistent item manipulation across versions while providing access to advanced features like unbreakable items, custom attributes, and other metadata properties that may not be fully supported by the standard Bukkit API.

See Also:
  • Constructor Details

    • ItemEditorProvider

      public ItemEditorProvider()
  • Method Details

    • provide

      @NotNull protected @NotNull AbstractItemEditor 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 item editor implementation based on the introduction of enhanced item properties in Minecraft 1.11. The selection ensures access to the most appropriate item manipulation methods for each version.

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