Skip to content

Add %money% placeholder support for BossBar#1972

Open
NoltoxGit wants to merge 8 commits into
Zrips:masterfrom
HeavenCube:feat/Bossbar-Money-Placeholder
Open

Add %money% placeholder support for BossBar#1972
NoltoxGit wants to merge 8 commits into
Zrips:masterfrom
HeavenCube:feat/Bossbar-Money-Placeholder

Conversation

@NoltoxGit

Copy link
Copy Markdown
Contributor

Description:

This PR introduces the %money% placeholder for the BossBar output, bringing its functionality closer to what is already available and well-handled in the ActionBar. Additionally, this PR fixes an edge case where the BossBar would not display at all if an action yielded only money but no experience (expGain == 0).

Changes Made:

  • JobProgression.java: Added a lastMoney variable (with getters and setters) to temporarily cache the money earned from an action before the BossBar updates, functioning identically to the existing lastExperience variable.
  • Jobs.java: Updated the action() and perform() methods so that prog.setLastMoney() aggregates the money earned before firing the JobsInstancePaymentEvent and the level-up checks.
  • BossBarManager.java:
    • Updated ShowJobProgression(player) to check if (oneJob.getLastExperience() != 0 || oneJob.getLastMoney() != 0). This ensures the BossBar still triggers for actions that only reward money and no XP.
    • Replaced the %money% placeholder in the command.stats.bossBarOutput message.
  • LanguageManager.java & Locale files: Added the %money% placeholder to the bossBarOutput default string in LanguageManager.java and updated all existing messages_*.yml translation files to include it by default.

Use Case:

Many server owners prefer to disable the ActionBar payment messages to avoid screen clutter and centralize all progression tracking (XP and Money) in the BossBar. Until now, there was no way to display the money earned directly on the BossBar.

Testing:

  • Verified that %money% correctly parses and displays the formatted amount.
  • Verified that %money% is replaced with an empty string when the action yields no money.
  • Verified that actions giving 0 XP but >0 Money successfully trigger the BossBar.
  • Compiled without errors and tested in-game.

@NoltoxGit

Copy link
Copy Markdown
Contributor Author

Hey @Zrips!
I have updated the branch with the latest changes from upstream/master. All conflicts have been resolved, including merging the BossBar money placeholder feature with the new asynchronous updates from upstream.

The project compiles successfully without any errors, and the PR is now ready to be merged!

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