Interface PlaceholderContext


  • public interface PlaceholderContext
    Contains the context that a PlaceholderParser can use to determine what to display.
    • Method Detail

      • associatedObject

        java.util.Optional<java.lang.Object> associatedObject()
        If provided, the Object which to pull information from when building the placeholder text.

        Examples of how this might affect a placeholder are:

        • For a "name" placeholder that prints out the source's name, the name would be selected from this source.
        • For a "current world" placeholder that returns a player's current world, this would pull the name of that current world from the player.

        It is important to note that the associated context does not necessarily have to be the sender/invoker of a message, nor does it have to be the recipient. The source is selected by the context of builder. It is up to plugins that use such placeholders to be aware of the context of which the placeholder is used. PlaceholderParsers should make no assumption about the origin of the context.

        If an invalid Object is provided for the context of the placeholder, then the associated PlaceholderParser must return a Component.empty().

        Returns:
        The associated Object, if any.
      • argumentString

        java.util.Optional<java.lang.String> argumentString()
        The variable string passed to this token to provide contextual information.
        Returns:
        The argument, if any