Skip to content

Complex sample players placeholders for server list ping#969

Merged
WouterGritter merged 18 commits into
libdeflatefrom
more-complex-placeholders
Jun 18, 2026
Merged

Complex sample players placeholders for server list ping#969
WouterGritter merged 18 commits into
libdeflatefrom
more-complex-placeholders

Conversation

@WouterGritter

@WouterGritter WouterGritter commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Introduces more complex sample player placeholders and the required parsing plumbing for this.

Example of what's possible to use for motd, motd-hover and fallback-version-ping:

{players:max=16:maxPerLine=8:ordering=ALPHABETICAL:empty=<gray>None:prefix=<yellow>:separator=<gray>, }

where:

  • max -> the maximum amount of players to show
  • maxPerLine -> the maximum amount of players to show per line
  • ordering -> how to order the players:
    • RANDOM -> random shuffle (Notchian behavior)
    • ALPHABETICAL -> A-Z (player name)
    • ALPHABETICAL_REVERSED -> Z-A (player name)
    • LAST_JOINED -> most recent joins first
    • FIRST_JOINED -> oldest joins first
  • empty -> what to show when no (0) players are online
  • prefix -> the prefix to append before each player name
  • separator -> the separator between every two player names (trimmed on line end)

Players are pooled meaning, players won't show up twice. This makes it possible to show the last player that joined, and a random list of all other online players, without this first player showing up in the random list. Example:

motd-hover = [
  "Players: {player-count} / {max-players}",
  "Last join:",
  "{players:ordering=LAST_JOINED:max=1}",
  "",
  "Other players:",
  "{players:ordering=RANDOM:max=6}"]
]

Would show the following MOTD hover:

Players: 100 / 500
Last join:
SomePlayer

Other players:
Notch
jeb_
APlayer
ANotherPlayer
wouterg_
wouterg_too

motd in the config may now also be a string list (similar to motd-hover).

TODO:

  • confirm colors are working in placeholder (especially version name)
  • config option to ignore "Anonymous Player" toggle on client (isClientListingAllowed)
  • config option to pool player list for motd + motd-hover + fallback-version-ping or have one pool per section
  • config migration for removed sample-players-in-ping (be smart about this: populate motd-hover based on if this was true/false to avoid changing behavior)
  • update config comments. add comments explaining the {players} behavior + argument examples
  • update config with sensible defaults (incl. moving motd to a string list)

Example of the PR in action:
image

@WouterGritter WouterGritter marked this pull request as draft June 17, 2026 16:29
@WouterGritter WouterGritter marked this pull request as ready for review June 18, 2026 10:25
@WouterGritter WouterGritter merged commit df018c6 into libdeflate Jun 18, 2026
1 check passed
@WouterGritter WouterGritter deleted the more-complex-placeholders branch June 18, 2026 11:24
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.

2 participants