Skip to content

32 add placeholderapi internal expansion#34

Merged
ez-plugins merged 4 commits into
mainfrom
32-add-placeholderapi-internal-expansion
Apr 15, 2026
Merged

32 add placeholderapi internal expansion#34
ez-plugins merged 4 commits into
mainfrom
32-add-placeholderapi-internal-expansion

Conversation

@ez-plugins
Copy link
Copy Markdown
Owner

Placeholders & Messages

New internal message tags (no PlaceholderAPI required)

Boost-context messages in messages.yml now support additional tags automatically.
You can use these in any message that relates to a specific boost:

Tag Example output
<boost> / <boost_display> Speed Boost
<boost_key> speed
<boost_cost> 50,000
<boost_cost_compact> 50K
<boost_cost_raw> 50000
<boost_duration> 120
<boost_cooldown> 60

Available in: boost-activated, boost-expired, boost-cooldown, boost-effect-cooldown, insufficient-funds, cost-charged, token-used.

Bug fix: <boost> now shows display name everywhere

Previously boost-expired, cost-charged, and token-used showed the internal config key (e.g. speed) instead of the configured display name (e.g. Speed Boost). This is now fixed. Use <boost_key> if you specifically need the raw config key.

9 new PlaceholderAPI placeholders

Requires PlaceholderAPI to be installed.

Placeholder Returns
%ezboost_has_active_boost% true or false
%ezboost_active_boost% Config key of the active boost, or empty
%ezboost_active_boost_display% Display name of the active boost, or empty
%ezboost_active_boost_time_remaining% Seconds remaining as a number
%ezboost_active_boost_time_remaining_formatted% MM:SS or HH:MM:SS
%ezboost_is_active_<boostkey>% true or false
%ezboost_cooldown_remaining_<boostkey>% Cooldown seconds as a number
%ezboost_cooldown_remaining_formatted_<boostkey>% MM:SS or HH:MM:SS
%ezboost_xp_multiplier% Active XP multiplier (1 if no XP boost is running)

Example uses:

  • Scoreboard line: Boost: %ezboost_active_boost_display% (%ezboost_active_boost_time_remaining_formatted%)
  • Condition check: show a button only when %ezboost_has_active_boost% equals false
  • XP display: XP rate: %ezboost_xp_multiplier%x

Introduces BoostTagResolvers, a static factory that builds a
TagResolver from a BoostDefinition and CurrencyFormatter.
All boost-context MiniMessage tags are available without
PlaceholderAPI:

  <boost> / <boost_display>  – display name
  <boost_key>                – internal config key
  <boost_cost>               – formatted cost
  <boost_cost_compact>       – compact cost (50K, 1.2M)
  <boost_cost_raw>           – raw numeric cost
  <boost_duration>           – duration in seconds
  <boost_cooldown>           – cooldown in seconds
  <cost> / <cost_compact>    – backward-compat aliases

5 unit tests cover all tags, backward-compat aliases, whole-number
raw cost, fractional raw cost, and the zero-cost Free case.
All boost-context messages now receive BoostTagResolvers.forBoost()
instead of hand-crafted Placeholder.parsed() calls. This makes
<boost_*>, <boost_cost>, etc. available to server operators in
messages.yml without any PlaceholderAPI dependency.

Changes:
- boost-activated, boost-cooldown (both paths), boost-effect-cooldown,
  insufficient-funds, cost-charged, token-used: replaced manual
  Placeholder.parsed() calls with BoostTagResolvers.forBoost()
- boost-expired: fixes long-standing bug where <boost> resolved to
  the raw config key instead of the display name
- Add getActiveBoostKey(Player) and getActiveBoostTimeRemaining(Player)
  public accessors (used by the PAPI expansion in the next commit)
- messages.yml: expand comment block to document all new available tags
New %ezboost_*% placeholders for use in external plugins,
scoreboards, signs, etc.:

  has_active_boost                       – true/false
  active_boost                           – current boost key
  active_boost_display                   – display name of active boost
  active_boost_time_remaining            – seconds remaining (integer)
  active_boost_time_remaining_formatted  – MM:SS or HH:MM:SS
  is_active_<boostkey>                   – plain boolean, no perm/cost logic
  cooldown_remaining_<boostkey>          – cooldown seconds (integer)
  cooldown_remaining_formatted_<boostkey>– MM:SS or HH:MM:SS
  xp_multiplier                          – active XP multiplier (1 if none)

All player-null guards return safe defaults ('', 'false', '0', '1').
Time formatting: MM:SS under 1 hour, HH:MM:SS at or above 1 hour.
xp_multiplier resolved via EzBoostAPI to avoid coupling to the plugin
instance.

8 new test methods added to EzBoostPlaceholderTest.
@ez-plugins ez-plugins linked an issue Apr 15, 2026 that may be closed by this pull request
@ez-plugins ez-plugins merged commit 3095fe6 into main Apr 15, 2026
2 checks passed
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.

Add PlaceholderAPI internal expansion

1 participant