Class Replacement

java.lang.Object
de.chojo.jdautil.localization.util.Replacement

public final class Replacement extends Object
  • Method Details

    • create

      public static Replacement create(String key, String value, Format... formats)
      Creates a new replacement.
      Parameters:
      key - key of replacement
      value - value for replacement
      formats - format which should be applied on the replacement.
      Returns:
      replacement with registered replacement
    • deserialize

      public static Replacement deserialize(String key, String value, boolean caseSensitive)
    • create

      public static Replacement create(String key, Object value, Format... formats)
      Creates a new replacement.
      Parameters:
      key - key of replacement
      value - value which provides a string via Object.toString()
      formats - format which should be applied on the replacement.
      Returns:
      replacement with registered replacement
    • create

      public static Replacement create(String key, User value, Format... formats)
      Creates a new replacement.
      Parameters:
      key - key of replacement
      value - value which provides the name of the player
      formats - format which should be applied on the replacement.
      Returns:
      replacement with registered replacement
    • createMention

      public static Replacement createMention(Role value)
      Creates a new replacement.
      Parameters:
      value - value which provides the name of the player
      Returns:
      replacement with registered replacement
    • createMention

      public static Replacement createMention(User value)
      Creates a new replacement.
      Parameters:
      value - value which provides the name of the player
      Returns:
      replacement with registered replacement
    • createMention

      public static Replacement createMention(Member value)
      Creates a new replacement.
      Parameters:
      value - value which provides the name of the player
      Returns:
      replacement with registered replacement
    • createMention

      public static Replacement createMention(String key, IMentionable value)
      Creates a new replacement.
      Parameters:
      value - value which provides the name of the player
      Returns:
      replacement with registered replacement
    • createMention

      public static Replacement createMention(TextChannel value)
      Creates a new replacement.
      Parameters:
      value - value which provides the name of the player
      Returns:
      replacement with registered replacement
    • addFormatting

      public Replacement addFormatting(Format... formats)
      Add formatting codes to the replacement. A §r will be appended after the replacement. Only provide the formatting character. Without § or &.
      Parameters:
      formats - formats which should be applied on the replacement.
      Returns:
      replacement with formatting set
    • matchCase

      public Replacement matchCase()
      Only replace the placeholder when its case matches exactly. By default the case is ignored.
      Returns:
      Replacement with value changed
    • invoke

      public String invoke(String string)
      Invoke the replacement on the string.
      Parameters:
      string - string to replace
      Returns:
      string with key replaced by value.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object