Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the available arguments in each format option #8

Open
granny opened this issue Apr 25, 2021 · 0 comments
Open

Document the available arguments in each format option #8

granny opened this issue Apr 25, 2021 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@granny
Copy link
Member

granny commented Apr 25, 2021

in Java there is a String formatter which allows variables (like %s) to be used as placeholders. s being the placeholder for String. since it does not contain a specific number, it will use them in order from first to last.

String.format("Hello %s! %s name is %s!", "world", "My", "Billy");
// Outputs: "Hello world! My name is Billy!"

You can specify the argument numbers like so:

String.format("Hello %3s! %1s name is %2s!", "world", "My", "Billy");
// Outputs: "Hello Billy! world name is My!"

There are other argument types than String, but that's all we use in Purpur's config.
To know what arguments are available, you can check out the source code to document them.

using ping-command-output as an example it could be formatted something like this:

ping-command-output

  • default: §a%s's ping is %sms
  • description: Output when /ping is run.
    %s - uses the values below in order from first to last
    %1 - player's name
    %2 - player's ping in ms
@granny granny added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant