Interface NmsBundle


public interface NmsBundle
The single entry point into one 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 Details

    • teleporter

      @NotNull default @NotNull AbstractTeleporter teleporter()
    • blockUtil

      @NotNull default @NotNull AbstractBlockUtil blockUtil()
    • chatColor

      @NotNull default @NotNull IChatColorNMS chatColor()
    • commandMapModifier

      @NotNull default @NotNull CommandMapModifier commandMapModifier()
    • componentLoggerAdapter

      @NotNull default @NotNull ComponentLoggerAdapter componentLoggerAdapter()
    • enchantId

      @NotNull default @NotNull AbstractEnchantID enchantId()
    • entityMethods

      @NotNull default @NotNull AbstractEntityMethods entityMethods()
    • itemEditor

      @NotNull default @NotNull AbstractItemEditor itemEditor()
    • itemText

      @NotNull default @NotNull AbstractItemTextPre_1_17 itemText()
    • itemNbt

      @NotNull default @NotNull AbstractItemNbt itemNbt()
      The item NBT an Adventure show_item hover is built from.

      Only 1.17 and 1.18.1 implement this. Below 1.17 the same values come from itemText(), whose interface extends AbstractItemNbt, and from 1.18.2 the server's own Adventure supplies the hover directly.

      Returns:
      this module's item NBT reader
    • mainHand

      @NotNull default @NotNull AbstractMainHand mainHand()
    • messageManager

      @NotNull default @NotNull AbstractMessageManager messageManager()
    • messageManager

      @NotNull default @NotNull AbstractMessageManager messageManager(@NotNull @NotNull AbstractItemTextPre_1_17 itemText)
      The pre-1.17 form. Those implementations render through md5's BaseComponent and 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

      @NotNull default @NotNull NmsItemMethods nmsItemMethods()
    • packetHandler

      @NotNull default @NotNull NMSPacketHandler packetHandler()
    • preSpawnSpawnerAdapter

      @NotNull default @NotNull Listener preSpawnSpawnerAdapter()
    • nmsWorld

      @NotNull default @NotNull NMSWorld nmsWorld(@NotNull @NotNull World world, @NotNull @NotNull Provider<AbstractBlockUtil> blockUtil)
    • worldEdit

      @NotNull default @NotNull WorldEditApi<?> worldEdit()
    • worldGuard

      @NotNull default @NotNull WorldGuardApi worldGuard(@NotNull @NotNull Plugin worldGuardPlugin, @NotNull @NotNull NMSWrapper<NMSWorld,World> worldWrapper)
    • componentFromPlainText

      @NotNull default @NotNull VersionedComponent componentFromPlainText(@NotNull @NotNull String text)
    • componentFromJson

      @NotNull default @NotNull VersionedComponent componentFromJson(@NotNull @NotNull String json)
      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 Adventure TagResolver.

      Each TextPlaceholder is 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 the versions/* 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

      @Nullable default @Nullable VersionedComponent getDisplayName(@NotNull @NotNull ItemMeta meta)
    • setLore

      @NotNull default @NotNull ItemMeta setLore(@NotNull @NotNull ItemMeta meta, @Nullable @Nullable List<VersionedComponent> lore)
    • getLore

      @Nullable default @Nullable List<VersionedComponent> getLore(@NotNull @NotNull ItemMeta meta)
    • 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