Skip to content

[WIP] Fix placeholder redirection for player statistics#12

Merged
NotPatch merged 2 commits intomasterfrom
copilot/fix-placeholder-redirection
Dec 26, 2025
Merged

[WIP] Fix placeholder redirection for player statistics#12
NotPatch merged 2 commits intomasterfrom
copilot/fix-placeholder-redirection

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 26, 2025

Fix Placeholder Parsing for Player Names with Underscores

The current implementation breaks when player names contain underscores (e.g., ItzFabbb___). This PR implements the requested solution:

Changes completed:

  • Update PlaceholderHook.java to support new placeholder format
    • Add support for %norder_player_<type>% (uses the player context from PlaceholderAPI)
    • Add support for %norder_player_{player_name}_<type>% (looks up specific player by name)
    • Fix parsing logic to handle player names with underscores correctly
  • Update README.md to document the new placeholder formats
  • Test the parsing logic to ensure it works correctly

Technical solution:

  • For %norder_player_<type>%: Uses the player parameter passed by PlaceholderAPI
  • For %norder_player_{player_name}_<type>%: Extracts player name by identifying the field name (last part) and reconstructing the player name from all middle parts joined with underscores
  • This allows player names to contain any number of underscores without breaking the parsing

Test results:

✓ Simple placeholders work: %norder_player_totalOrders%
✓ Player names without underscores work: %norder_player_NotPatch_totalOrders%
✓ Player names with trailing underscores work: %norder_player_ItzFabbb____totalOrders%
✓ Player names with underscores in multiple positions work: %norder_player_Test_User_123__totalEarnings%

Original prompt

This section details on the original issue you should resolve

<issue_title>Parsing an Placeholder Issue</issue_title>
<issue_description>```
%norder_player_<>
%norder_player
totalOrders%
%norder_player
totalEarnings%
%norder_player
totalDelivered%
%norder_player
_totalCollected%


I Think these placeholder needs to be re-directed to 
%norder_player_<>% instead of using "`%norder_player_<another_player>_<type>%`"

then if so we want to look the other player's statistics,
we can do

%norder_player_{player_name}<>
%norder_player
{player_name}totalOrders%
%norder_player
{player_name}totalEarnings%
%norder_player
{player_name}totalDelivered%
%norder_player
{player_name}_totalCollected%


As of right now i find that these placeholders is kinda have no purpose whatsoever, because minecraft ign also can be something like this 

<img width="206" height="46" alt="Image" src="https://github.com/user-attachments/assets/323590ac-1928-4fbe-ac84-611e250578bb" />

Tried to parsing the placeholder but to no affail:

<img width="745" height="100" alt="Image" src="https://github.com/user-attachments/assets/89cdfa89-ed5e-4da4-a3bb-27ab69840ebe" /></issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@NotPatch NotPatch marked this pull request as ready for review December 26, 2025 10:57
@NotPatch NotPatch marked this pull request as draft December 26, 2025 10:58
Co-authored-by: NotPatch <57406847+NotPatch@users.noreply.github.com>
Copilot AI requested a review from NotPatch December 26, 2025 11:00
@NotPatch NotPatch marked this pull request as ready for review December 26, 2025 11:06
@NotPatch NotPatch merged commit 7edeffa into master Dec 26, 2025
1 check failed
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.

Parsing an Placeholder Issue

2 participants