Skip to content

Fix ItemsAdder startup issues & add MiniMessage support - #644

Open
diamond-turtle wants to merge 5 commits into
RockinChaos:masterfrom
diamond-turtle:minimessage-support
Open

diamond-turtle wants to merge 5 commits into
RockinChaos:masterfrom
diamond-turtle:minimessage-support

Conversation

@diamond-turtle

Copy link
Copy Markdown

This PR fixes several ItemsAdder integration issues and adds MiniMessage support for item names/lore.

Changes

ItemsAdder

  • Replaced NBT-copying with an ItemProvider abstraction so integrations can provide real ItemStacks.
  • Added ItemsAdderProvider using CustomStack, ensuring ItemsAdder metadata (tooltips, model data, etc.) is preserved.
  • Refreshes external items after ItemsAdderLoadDataEvent (FIRST_LOAD and RELOAD) so players receive fully initialized ItemsAdder items.
  • Fixed startup detection by checking PluginManager#getPlugin() instead of isPluginEnabled(), resolving the STARTUP vs POSTWORLD load-order issue that prevented ItemsAdder support on a cold server start.

MiniMessage

  • Added MiniMessage support for item names and lore.
  • Existing &-formatted configs continue to work unchanged.
  • Uses Adventure Component APIs (customName, lore) to preserve RGB/gradient formatting.

Notes

  • Lines containing MiniMessage tags should use MiniMessage formatting exclusively; mixed & + MiniMessage formatting is not supported.
  • Fixed %item% in cooldown messages using the wrong item name source.

Build

  • Updated Adventure to 4.26.1.
  • Switched from spigot-api to paper-api.
  • Adventure is now a provided dependency.

Introduces me.RockinChaos.itemjoin.item.provider (ItemProvider,
ItemProviderRegistry) so items can be sourced as real, live ItemStacks
from a third-party plugin instead of faked with copied NBT data.
ItemsAdderProvider is the first implementation, using ItemsAdder's
CustomStack API (getInstance/getItemStack, byItemStack) for both
resolving and reverse-matching items. Items configured with
provider/provider-key are resolved fresh on every ItemMap update, so
changes to the source ItemsAdder item are reflected without reloading
ItemJoin.
Item display names/lores and all plugin messages/lang-file strings now
accept MiniMessage tags (gradients, <bold>, <#RRGGBB>, etc.) alongside
the existing '&' legacy color codes. Tags are resolved to legacy
section-sign codes (with full hex precision) via a new MiniMessageUtils
utility before StringUtils.translateLayout runs, so existing configs
are unaffected. Lang-file/message sends previously routed through
ChaosCore's opaque sendLangMessage/dispatchMessage now go through
drop-in wrapper methods with identical signatures that pre-resolve
tags before delegating to the same underlying send logic.

Adds net.kyori adventure-api/adventure-text-minimessage/
adventure-text-serializer-legacy as shaded, relocated dependencies,
matching the existing ChaosCore relocation pattern.
ItemsAdder loads its custom item registry and resource pack asynchronously,
which is not guaranteed to be done by the time ItemJoin resolves
ItemsAdder-backed items during server startup. Players ended up holding
ItemStacks missing data such as tooltips until items were manually
refreshed. Now listens for ItemsAdderLoadDataEvent and re-resolves/replaces
any already-held ItemStacks sourced from the provider.
…n time

ItemJoin loads at STARTUP while ItemsAdder loads POSTWORLD, so ItemJoin's
provider registry and event listener always registered before ItemsAdder
ever became "enabled" - isPluginEnabled() was permanently false at that
point on a cold boot, regardless of softdepend order (softdepend only
orders plugins within the same load phase). This silently disabled the
ItemsAdder item provider and its refresh listener on every real restart,
only working after a manual /ij reload once ItemsAdder was already up.

Switch both checks to getPlugin() != null, which reflects the plugin
being loaded rather than enabled, and add logging so the detection state
is visible in the console on startup.
…ssage colors

Bukkit's deprecated String-based ItemMeta setters (setDisplayName, setLore)
round-trip through a legacy parser that snaps hex/gradient MiniMessage
colors down to the nearest of the 16 named ChatColors, and can't carry
ObjectComponent-based tags like <head>/<sprite> at all. Switch item name,
lore, and outgoing chat/lang messages to Adventure's Component-based APIs
(customName, lore, Audience#sendMessage) so MiniMessage output survives
intact.

MiniMessage unconditionally rejects any literal '§' character, so
translateLayoutComponent() only ever hands MiniMessage raw, untranslated
text (gated behind a TAG_HINT check so untagged strings skip straight to
the existing legacy '&' pipeline), pre-resolving only the placeholders
that could plausibly appear as a tag argument beforehand.

Also fixes two spots (cooldown messages) that were resolving the %item%
placeholder from the already color-translated display name instead of
the raw config name.

Bumps Adventure to 4.26.1 and switches the API dependency from
spigot-api to paper-api, with Adventure moved to provided scope, since
the relocated/shaded Adventure classes shipped by spigot-api are stale
enough to throw NoSuchMethodError against these newer Component APIs at
runtime.
@diamond-turtle

diamond-turtle commented Jul 21, 2026

Copy link
Copy Markdown
Author
image
items:
  item_1:
    id: ELYTRA
    slot: chestplate
    provider: ItemsAdder
    provider-key: hypertale:elytra
    itemflags: glowing, hide-attributes, hide-flags, inventory-modify, placement, always-give
    name: '       <gradient:#76969c:#c2f6ff:#76969c>ᴢᴜᴢᴜ''ꜱ ᴇʟʏᴛʀᴀ</gradient>       '
    lore: 
    - '<color:#e8e1c9>ꜱᴏᴀʀ ɪɴᴛᴏ ᴛʜᴇ <#c2f6ff><b>ꜱᴋɪᴇꜱ'
    - '<color:#e8e1c9>ᴡɪᴛʜ ᴛʜɪꜱ <sprite:"minecraft:items":item/elytra> ᴇʟʏ-'
    - '<shadow:#6fff00>ᴡᴀɪᴛ..'
    - '<rainbow>ɢʀᴀᴅɪᴇɴᴛꜱ??????</rainbow> <head:imonlyzuzu>'

@diamond-turtle

Copy link
Copy Markdown
Author
image
  join_survival:
    id: amethyst_cluster
    slot: 4
    provider: ItemsAdder
    commands-sound: block.note_block.banjo
    commands-cooldown: 5
    itemflags: glowing, hide-attributes, hide-flags, inventory-modify, placement, always-give
    provider-key: hypertale:amethyst_cluster
    name: '     <gradient:#6600ff:#8b0fff:#6600ff><b>ᴊᴏɪɴ ᴇᴀʀᴛʜ ꜱᴜʀᴠɪᴠᴀʟ</b></gradient>     '
    lore:
    - ' '
    - '       <color:#e8e1c9>ᴄʟɪᴄᴋ ᴛᴏ <color:#8b0fff>ʙᴇɢɪɴ ʏᴏᴜʀ'
    - '    <color:#e8e1c9>ᴇᴘɪᴄ ꜱᴜʀᴠɪᴠᴀʟ ᴀᴅᴠᴇɴᴛᴜʀᴇ'
    - ' '
    - '            <color:#8b0fff>[ <color:#e8e1c9>ᴘʟᴀʏ ɴᴏᴡ <color:#8b0fff>]'
    interact:
      - 'player: earth'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant