Enum Class MiniMessage.Preset

java.lang.Object
java.lang.Enum<MiniMessage.Preset>
net.kyori.adventure.text.minimessage.MiniMessage.Preset
All Implemented Interfaces:
Serializable, Comparable<MiniMessage.Preset>, Constable, Consumer<MiniMessage.Builder>
Enclosing interface:
MiniMessage

public static enum MiniMessage.Preset extends Enum<MiniMessage.Preset> implements Consumer<MiniMessage.Builder>
A variety of presets for configuring MiniMessage.

These presets can be used to get a default confuguration for MiniMessage by using the MiniMessage.miniMessage(Preset) method.

Alternatively, you can get a pre-configured builder based on a preset. This can be used to make your own custom MiniMessage instance whilst still keeping any configuration provided by a preset, such as post-processing. An example of how to do this is provided below.


// Obtain the pre-configured builder.
final MiniMessage.Builder builder = MiniMessage.builder(MiniMessage.Preset.NON_INTERACTABLE);

// Add your own tags or override other settings if needed.
builder.editTags(tags -> {
  tags
    .resolver(new MyCustomTagResolver())
    .resolver(fetchExternalTags());
});

// Then build your MiniMessage instance!
final MiniMessage myMiniMessageInstance = builder.build();

Since:
5.0.0
See Also:
  • Enum Constant Details

    • DEFAULT

      public static final MiniMessage.Preset DEFAULT
      The default preset, containing all features of MiniMessage.
      Since:
      5.0.0
    • NON_INTERACTABLE

      public static final MiniMessage.Preset NON_INTERACTABLE
      A preset that disables all interactive features, such as hover and click events.

      This preset also removes hover and click events from the returned component using a custom post-processor.

      Since:
      5.0.0
    • FORMATTED_TEXT

      public static final MiniMessage.Preset FORMATTED_TEXT
      A preset that disables all non-text component types and only allows formatting text components (i.e., color, shadow, decorations, fonts).

      This preset also performs the following modifications to the resulting component using a custom post-processor:

      • Removes click events, hover events, and insertions from all text components.
      • Filters out any non-text components.
      Since:
      5.0.0
  • Field Details

    • NAMES

      public static final Index<String, MiniMessage.Preset> NAMES
      The name map.

      This can be used to easily make configurable presets.

      Since:
      5.0.0
  • Method Details

    • values

      public static MiniMessage.Preset[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MiniMessage.Preset valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null