Class NmsItemProvider
This provider selects the appropriate NmsItemMethods
implementation
based on the current Minecraft version, handling the evolution of item systems
and internationalization (i18n) naming conventions. NMS item methods provide
access to internal item names and properties not available through Bukkit APIs.
The provider covers major changes in item handling systems:
- 1.8-1.12: Legacy item systems with basic i18n support
- 1.13+: Flattened item system with updated naming conventions
- 1.17+: Significant NMS restructuring affecting item access
- 1.20.5+: Mojang-mapped Paper NMS for improved stability
These implementations provide access to internal item names, translation keys, and other properties that are essential for plugins requiring deep item inspection or compatibility with external systems expecting specific item identifiers.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull NmsItemMethods
provide
(int ver) Creates the appropriate implementation for the specified NMS version.
-
Constructor Details
-
NmsItemProvider
public NmsItemProvider()
-
-
Method Details
-
provide
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 appropriate NMS item methods implementation based on Minecraft version, accounting for the evolution of item systems and naming conventions. The selection ensures access to the most appropriate item inspection methods for each version.
- Specified by:
provide
in classProvider<NmsItemMethods>
- Parameters:
ver
- the formatted NMS version integer- Returns:
- the version-appropriate
NmsItemMethods
implementation - Throws:
IllegalArgumentException
- if the version is below 1.8 (unsupported)
-