Skip to content

Message placeholders, context, and dynamic properties #2

@WillBAnders

Description

@WillBAnders

Description

Placeholders allow messages to access and include information that is not specifically provided by the developer as an argument to the function. For example, if a command is run by a player placeholders can be used to get information like the player's world or position through properties. These can then be combined as needed to result in a much more power placeholder system than existing methods.

Examples

  • ${@player.world}
    • Retrieves the argument player and gets their world (printing the name)
  • ${#player.position.x}
    • Retrieves the player from the context and gets the x coordinate of their position
  • ${#date}
    • Retrieves the current date from the context, formatted as yyyy-mm-dd

Motivation

Placeholders are a powerful way to customize messages and open up a lot of possibilities for the user. A system like this is necessary to maintain good performance with so many options, and makes it easy for developers to support such behavior. If it were possible to handle placeholders with arguments, then grammatical cases like a/an and singular/plural could be handled as well.

Metadata

Metadata

Assignees

Labels

featureFeature requests and other additionsmessage-libraryTopics related to the Message library

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions