32 add placeholderapi internal expansion#34
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Placeholders & Messages
New internal message tags (no PlaceholderAPI required)
Boost-context messages in
messages.ymlnow support additional tags automatically.You can use these in any message that relates to a specific boost:
<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>60Available in:
boost-activated,boost-expired,boost-cooldown,boost-effect-cooldown,insufficient-funds,cost-charged,token-used.Bug fix:
<boost>now shows display name everywherePreviously
boost-expired,cost-charged, andtoken-usedshowed 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.
%ezboost_has_active_boost%trueorfalse%ezboost_active_boost%%ezboost_active_boost_display%%ezboost_active_boost_time_remaining%%ezboost_active_boost_time_remaining_formatted%MM:SSorHH:MM:SS%ezboost_is_active_<boostkey>%trueorfalse%ezboost_cooldown_remaining_<boostkey>%%ezboost_cooldown_remaining_formatted_<boostkey>%MM:SSorHH:MM:SS%ezboost_xp_multiplier%1if no XP boost is running)Example uses:
Boost: %ezboost_active_boost_display% (%ezboost_active_boost_time_remaining_formatted%)%ezboost_has_active_boost%equalsfalseXP rate: %ezboost_xp_multiplier%x