Class FlagMessageBuilder

java.lang.Object
de.z0rdak.yawp.util.text.messages.FlagMessageBuilder

public class FlagMessageBuilder extends Object
  • Field Details

  • Constructor Details

    • FlagMessageBuilder

      public FlagMessageBuilder()
  • Method Details

    • defaultSubstitutesFor

      public static Map<String,String> defaultSubstitutesFor(FlagCheckResult result)
      Returns a map with default substitutes for the given flag check result.
      The substitutes are built from the flag, responsible region, position and player in the result.
      The substitutes are then returned as a map.
      Parameters:
      result - the flag check result to get the default substitutes for
      Returns:
      a map with default substitutes for the given flag check result
    • buildFrom

      public static net.minecraft.network.chat.MutableComponent buildFrom(FlagCheckResult result, @Nullable @Nullable Map<String,String> substitutes)
      Builds a flag message from the given flag check result and substitutes.
      The flag message is built from the flag message template of the flag in the result.
      The matches in the flag message template are replaced with the substitutes.
      The flag message is then returned as a MutableComponent.
      Contract: Flag must not be null. Responsible region must not be null.
      Parameters:
      result - the flag check result to build the message for
      substitutes - the substitutes to replace the matches in the flag message template with
      Returns:
      the flag message for the given flag check result and substitutes