Class InventoryApiNMS
java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.nms.InventoryApiNMS
Picks the right
InventoryTitleUpdater for the running server. The strategy is:
- If the server exposes the modern public Bukkit API — the parsed minor version is 20 or
newer (1.20+), or the CraftBukkit package is un-versioned (Paper 1.20.5+, where no
vX_Y_RZsuffix is present) — returnBukkitInventoryTitleUpdater, which usesInventoryView#setTitle(added in 1.20). - Otherwise, look up the legacy CraftBukkit package suffix (e.g.
v1_19_R3) and instantiate the matching per-version NMS class.
The dispatch uses static references — not reflection — so that the maven-shade-plugin's
minimizer keeps each per-version class in the consumer's plugin jar. The JVM still loads
each TitleUpdater_1_X_RY lazily on first use, so a server running 1.16.5 never
resolves the net.minecraft.server.v1_19_R3.* types referenced by
TitleUpdater_1_19_R3 — only the chosen branch is linked.
-
Method Summary
Modifier and TypeMethodDescriptionstatic InventoryTitleUpdaterResolves theInventoryTitleUpdaterappropriate for the current server.
-
Method Details
-
getTitleUpdater
Resolves theInventoryTitleUpdaterappropriate for the current server.- Returns:
- the resolved updater
- Throws:
IllegalStateException- if the server version is older than 1.20 and the matching per-version NMS implementation cannot be found on the classpath
-