Interface NmsBundle
versions/* module.
Every implementation of this interface lives inside the version module it speaks for, is
named com.kamikazejam.kamicommon.nms.bundle.<module>.NmsBundleImpl, and is loaded by
NmsBundles.forModule(String) through Class.forName(String), never named
statically from :core.
That indirection is the whole point, and it is not stylistic. Every
Provider.provide(int) in this library is declared to return an abstract type and then
constructs a subclass. That forces the verifier to perform an assignability check, and the check
loads the subclass.
So a new Teleporter_LATEST() sitting in a branch that a 1.8.8 server never takes still
stops the whole provider from loading there, with UnsupportedClassVersionError, before any
method runs. Resolving the module by name defers that load until the branch is actually taken, so
each versions/* module can target the JVM its own Minecraft version required.
Every capability defaults to throwing. A module implements only what it ships: v1_21_9
carries one class and overrides one method, while v_latest overrides most of them. Adding
a capability here is therefore source-compatible with every existing module.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull ItemMetaaddLoreLine(@NotNull ItemMeta meta, @NotNull VersionedComponent component) default @NotNull AbstractBlockUtildefault @NotNull IChatColorNMSdefault @NotNull CommandMapModifierdefault @NotNull VersionedComponentcomponentFromJson(@NotNull String json) JSON in, component out.default @NotNull VersionedComponentcomponentFromLegacyAmpersand(@NotNull String legacy) default @NotNull VersionedComponentcomponentFromLegacySection(@NotNull String legacy) default @NotNull VersionedComponentcomponentFromMiniMessage(@NotNull String miniMessage) default @NotNull VersionedComponentcomponentFromMiniMessage(@NotNull String miniMessage, @NotNull TextPlaceholder... placeholders) MiniMessage with tag replacements, without the caller naming an AdventureTagResolver.default @NotNull VersionedComponentcomponentFromPlainText(@NotNull String text) default @NotNull ComponentLoggerAdapterdefault @NotNull AbstractEnchantIDdefault @NotNull AbstractEntityMethodsdefault @Nullable VersionedComponentgetDisplayName(@NotNull ItemMeta meta) default @Nullable List<VersionedComponent> default @NotNull AbstractItemEditordefault @NotNull AbstractItemNbtitemNbt()The item NBT an Adventureshow_itemhover is built from.default @NotNull AbstractItemTextPre_1_17itemText()default @NotNull AbstractMainHandmainHand()default @NotNull AbstractMessageManagerdefault @NotNull AbstractMessageManagermessageManager(@NotNull AbstractItemTextPre_1_17 itemText) The pre-1.17 form.default @NotNull UnsupportedOperationExceptionThe exception every unimplemented capability throws.default @NotNull NmsItemMethodsdefault @NotNull NMSWorldnmsWorld(@NotNull World world, @NotNull Provider<AbstractBlockUtil> blockUtil) default @NotNull NMSPacketHandlerdefault @NotNull Listenerdefault @NotNull ItemMetasetDisplayName(@NotNull ItemMeta meta, @Nullable VersionedComponent component) default @NotNull ItemMetasetLore(@NotNull ItemMeta meta, @Nullable List<VersionedComponent> lore) default @NotNull AbstractTeleporterdefault @NotNull WorldEditApi<?> default @NotNull WorldGuardApiworldGuard(@NotNull Plugin worldGuardPlugin, @NotNull NMSWrapper<NMSWorld, World> worldWrapper)
-
Method Details
-
teleporter
-
blockUtil
-
chatColor
-
commandMapModifier
-
componentLoggerAdapter
-
enchantId
-
entityMethods
-
itemEditor
-
itemText
-
itemNbt
The item NBT an Adventureshow_itemhover is built from.Only 1.17 and 1.18.1 implement this. Below 1.17 the same values come from
itemText(), whose interface extendsAbstractItemNbt, and from 1.18.2 the server's own Adventure supplies the hover directly.- Returns:
- this module's item NBT reader
-
mainHand
-
messageManager
-
messageManager
@NotNull default @NotNull AbstractMessageManager messageManager(@NotNull @NotNull AbstractItemTextPre_1_17 itemText) The pre-1.17 form. Those implementations render through md5'sBaseComponentand need the version's own item-text renderer handed to them; 1.17+ uses adventure and takes nothing.- Parameters:
itemText- the item-text implementation for this server version- Returns:
- this module's message manager
-
nmsItemMethods
-
packetHandler
-
preSpawnSpawnerAdapter
-
nmsWorld
@NotNull default @NotNull NMSWorld nmsWorld(@NotNull @NotNull World world, @NotNull @NotNull Provider<AbstractBlockUtil> blockUtil) -
worldEdit
-
worldGuard
@NotNull default @NotNull WorldGuardApi worldGuard(@NotNull @NotNull Plugin worldGuardPlugin, @NotNull @NotNull NMSWrapper<NMSWorld, World> worldWrapper) -
componentFromPlainText
-
componentFromJson
JSON in, component out. How the two Adventure tiers exchange content without shared types. -
componentFromMiniMessage
@NotNull default @NotNull VersionedComponent componentFromMiniMessage(@NotNull @NotNull String miniMessage) -
componentFromMiniMessage
@NotNull default @NotNull VersionedComponent componentFromMiniMessage(@NotNull @NotNull String miniMessage, @NotNull @NotNull TextPlaceholder... placeholders) MiniMessage with tag replacements, without the caller naming an AdventureTagResolver.Each
TextPlaceholderis converted to whichever resolver this module's Adventure copy uses. That conversion is the whole reason this overload exists: it keeps the resolver type inside theversions/*module, where the shaded Adventure belongs. -
componentFromLegacyAmpersand
@NotNull default @NotNull VersionedComponent componentFromLegacyAmpersand(@NotNull @NotNull String legacy) -
componentFromLegacySection
@NotNull default @NotNull VersionedComponent componentFromLegacySection(@NotNull @NotNull String legacy) -
setDisplayName
@NotNull default @NotNull ItemMeta setDisplayName(@NotNull @NotNull ItemMeta meta, @Nullable @Nullable VersionedComponent component) -
getDisplayName
-
setLore
@NotNull default @NotNull ItemMeta setLore(@NotNull @NotNull ItemMeta meta, @Nullable @Nullable List<VersionedComponent> lore) -
getLore
-
addLoreLine
@NotNull default @NotNull ItemMeta addLoreLine(@NotNull @NotNull ItemMeta meta, @NotNull @NotNull VersionedComponent component) -
missing
@NotNull default @NotNull UnsupportedOperationException missing(@NotNull @NotNull String capability) The exception every unimplemented capability throws. Names the adapter, which names the module, so a dispatch table pointing at the wrong module says so instead of returning null.- Parameters:
capability- the method that was called- Returns:
- the exception to throw
-