Class TranslatableMessageFormatter

java.lang.Object
org.sgrewritten.stargate.util.TranslatableMessageFormatter

public final class TranslatableMessageFormatter extends Object
The translatable message formatter is responsible for formatting translatable messages

The translatable message formatter is mainly used for replacing placeholders in translatable message

  • Method Details

    • formatCost

      public static String formatCost(String unformattedMessage, double cost)
      Replaces the %cost% in a string with the given cost
      Parameters:
      unformattedMessage -

      The unformatted message to format

      cost -

      The cost to insert

      Returns:

      The message with the cost placeholder replaced with the given cost

    • formatPortal

      public static String formatPortal(String unformattedMessage, String portalName)
      Replaces the %portal% in a string with the given portal name
      Parameters:
      unformattedMessage -

      The unformatted message to format

      portalName -

      The portal name to replace the placeholder with

      Returns:

      The message with the portal placeholder replaced with the given portal name

    • formatWorld

      public static String formatWorld(String unformattedMessage, String worldName)
      Replaces the %world% in a string with the given world name
      Parameters:
      unformattedMessage -

      The unformatted message to format

      worldName -

      The world name to replace the placeholder with

      Returns:

      The message with the world placeholder replaced with the given world name

    • formatNetwork

      public static String formatNetwork(String unformattedMessage, String networkName)
      Replaces the %network% in a string with the given network name
      Parameters:
      unformattedMessage -

      The unformatted message to format

      networkName -

      The network name to replace the placeholder with

      Returns:

      The message with the network name placeholder replaced with the given network name

    • formatFlags

      public static String formatFlags(String unformattedMessage, Set<PortalFlag> flags)
      Replaces the %flags% in a string with the given set of flags
      Parameters:
      unformattedMessage -

      The unformatted message to format

      flags -

      The flags to replace the placeholder with

      Returns:

      The message with the flags placeholder replaced with the given flags

    • formatVersion

      public static String formatVersion(String unformattedMessage, String version)
      Replaces the %version% in a string with the given version
      Parameters:
      unformattedMessage -

      The unformatted message to format

      version -

      The version to replace the placeholder with

      Returns:

      The message with the version placeholder replaced with the given version

    • formatUnimplementedConflictMessage

      public static String formatUnimplementedConflictMessage(Network interServer, @Nullable Network local, LanguageManager languageManager)
      Parameters:
      interServer -

      The inter-server network at conflict

      local -

      The local network at conflict (none if null)

      languageManager -

      A languageManager

      Returns:

      A formated TranslatableMessage.UNIMPLEMENTED_CONFLICT message

    • formatNetworkType

      public static String formatNetworkType(String message, NetworkType type, LanguageManager languageManager)