Record Class LocalizedMessages.Key

java.lang.Object
java.lang.Record
net.realdarkstudios.commons.util.LocalizedMessages.Key
Record Components:
localization - The Localization this key will use
path - The path of the key (such as "plugin.update.fail")
styleOptions - The LocalizedMessages.StyleOptions this key will use
Enclosing class:
LocalizedMessages

public static record LocalizedMessages.Key(Localization localization, String path, LocalizedMessages.StyleOptions styleOptions) extends Record
Creates a new Localization Message Key
Since:
0.3.1.0
  • Constructor Details

  • Method Details

    • getLocalization

      public Localization getLocalization()
      Returns the localization that this key will use
      Returns:
      The Localization of this key
    • getPath

      public String getPath()
      Returns the path inside the localization this key uses
      Returns:
      The path of this key
    • getStyleOptions

      public LocalizedMessages.StyleOptions getStyleOptions()
      Returns this key's style options
      Returns:
      The LocalizedMessages.StyleOptions of this key
    • getRawMessage

      public String getRawMessage()
      Gets the raw message (no formatting)
      Returns:
      The raw message
      Since:
      0.3.1.0
    • getMessage

      public String getMessage(Object... formatArgs)
      Gets the message
      Parameters:
      formatArgs - The format arguments
      Returns:
      The message
      Since:
      0.3.1.0
    • getPrefix

      public net.md_5.bungee.api.chat.TextComponent getPrefix()
    • translateComponent

      public net.md_5.bungee.api.chat.TextComponent translateComponent(Object... formatArgs)
      Translates this LocalizedMessages.Key into a TextComponent
      Parameters:
      formatArgs - The format arguments
      Returns:
      The translated TextComponent
      Since:
      0.3.1.0
    • translateComponentWithPrefix

      public net.md_5.bungee.api.chat.TextComponent translateComponentWithPrefix(boolean withPrefix, Object... formatArgs)
      Translates this LocalizedMessages.Key into a TextComponent
      Parameters:
      formatArgs - The format arguments
      Returns:
      The translated TextComponent
      Since:
      0.3.1.0
    • translate

      public String translate(Object... formatArgs)
      Translates this LocalizedMessages.Key into a string
      Parameters:
      formatArgs - The format arguments
      Returns:
      The translated string
      Since:
      0.3.1.0
    • translateComponentWithOtherStyle

      public net.md_5.bungee.api.chat.TextComponent translateComponentWithOtherStyle(LocalizedMessages.StyleOptions styleOptions, Object... formatArgs)
      Translates this LocalizedMessages.Key into a TextComponent with different LocalizedMessages.StyleOptions
      Parameters:
      styleOptions - The overriding LocalizedMessages.StyleOptions
      formatArgs - The format arguments
      Returns:
      The translated TextComponent
      Since:
      0.3.1.0
    • translateWithOtherStyle

      public String translateWithOtherStyle(LocalizedMessages.StyleOptions styleOptions, Object... formatArgs)
      Translates this LocalizedMessages.Key into a string with different LocalizedMessages.StyleOptions
      Parameters:
      styleOptions - The overriding LocalizedMessages.StyleOptions
      formatArgs - The format arguments
      Returns:
      The translated string
      Since:
      0.3.1.0
    • console

      public String console(Object... formatArgs)
      A dedicated version of translateComponent(Object...) that removes all formatting codes from the output
      Parameters:
      formatArgs - The format arguments
      Returns:
      The translated string
      Since:
      0.3.1.0
    • consoleWithPrefix

      public String consoleWithPrefix(boolean withPrefix, Object... formatArgs)
    • localizationHasPath

      public boolean localizationHasPath()
      Checks if the Localization has this path in it
      Returns:
      true if the localization has the path, false otherwise
      Since:
      0.3.1.0
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • localization

      public Localization localization()
      Returns the value of the localization record component.
      Returns:
      the value of the localization record component
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • styleOptions

      public LocalizedMessages.StyleOptions styleOptions()
      Returns the value of the styleOptions record component.
      Returns:
      the value of the styleOptions record component