Class Txt

java.lang.Object
com.kamikazejam.kamicommon.util.Txt

public class Txt extends Object
  • Field Details

  • Constructor Details

    • Txt

      public Txt()
  • Method Details

    • upperCaseFirst

      @Contract("null -> null; !null -> !null") public static String upperCaseFirst(String string)
    • lowerCaseFirst

      @Contract("null -> null; !null -> !null") public static String lowerCaseFirst(String string)
    • isVowel

      @Contract("null -> false") public static boolean isVowel(String str)
    • aan

      @NotNull public static @NotNull String aan(String noun)
    • implode

      @NotNull public static @NotNull String implode(Object @NotNull [] list, String glue)
    • implode

      @NotNull public static @NotNull String implode(@NotNull @NotNull Collection<?> coll, String glue)
    • implode

      @NotNull public static @NotNull String implode(@NotNull @NotNull Collection<?> coll, String glue, @Nullable @Nullable String format)
    • implode

      @NotNull public static @NotNull String implode(Object @NotNull [] list, String glue, @Nullable @Nullable String format)
    • implodeCommaAndDot

      @NotNull public static @NotNull String implodeCommaAndDot(@NotNull @NotNull Collection<?> objects, @Nullable @Nullable String format, String comma, String and, String dot)
    • camelSplit

      @NotNull public static @NotNull List<String> camelSplit(String string)
    • getFiltered

      @NotNull public static <T> @NotNull List<T> getFiltered(@NotNull @NotNull Iterable<T> elements, @NotNull @NotNull Predicate<T> predicate)
    • getFiltered

      @NotNull public static <T> @NotNull List<T> getFiltered(T @NotNull [] elements, @NotNull @NotNull Predicate<T> predicate)
    • getStartsWithIgnoreCase

      @NotNull public static @NotNull List<String> getStartsWithIgnoreCase(@NotNull @NotNull Iterable<String> elements, String prefix)
    • getStartsWithIgnoreCase

      @NotNull public static @NotNull List<String> getStartsWithIgnoreCase(String @NotNull [] elements, String prefix)
    • getNicedEnumString

      @NotNull public static @NotNull String getNicedEnumString(@NotNull @NotNull String str, String glue)
    • getNicedEnumString

      @NotNull public static @NotNull String getNicedEnumString(@NotNull @NotNull String str)
    • getNicedEnum

      @NotNull public static <T extends Enum<T>> @NotNull String getNicedEnum(@NotNull T enumObject, String glue)
    • getNicedEnum

      @NotNull public static <T extends Enum<T>> @NotNull String getNicedEnum(@NotNull T enumObject)
    • getMaterialName

      @NotNull public static @NotNull String getMaterialName(@NotNull @NotNull Material material)
    • getItemName

      @NotNull public static @NotNull VersionedComponent getItemName(@Nullable @Nullable ItemStack itemStack)
      Determines the correct visible name of an item, based on its data (custom name and enchantment glint).
      Uses a default name of "Nothing" if the item is null or empty.
      See also getItemName(ItemStack, VersionedComponent) for supplying your own default name.
      Returns:
      The name of the item, or a default name if the item is null or empty.
    • getItemName

      @NotNull public static @NotNull VersionedComponent getItemName(@Nullable @Nullable ItemStack itemStack, @NotNull @NotNull VersionedComponent defaultName)
      Determines the correct visible name of an item, based on its data (custom name and enchantment glint).
      Uses the supplied if the item is null or empty.
      Returns:
      The name of the item, or the supplied default name if the item is null or empty.
    • tokenizeArguments

      @NotNull public static @NotNull List<String> tokenizeArguments(@NotNull @NotNull String str)
    • removeSmartQuotes

      @Contract("null -> null; !null -> !null") public static String removeSmartQuotes(String string)
    • titleize

      @NotNull public static @NotNull VersionedComponent titleize(@NotNull @NotNull String titleMini)
      Formats a given title to be centered in a titleized line.

      Titleized lines can be configured in Txt.Config

      They feature the centered in additional 'titleized' line characters.
      Parameters:
      titleMini - The unformatted title, which will be titleized (still in MiniMessage format).
      Returns:
      The titleized page title as a VersionedComponent.
    • titleizedPageTitle

      @NotNull public static @NotNull VersionedComponent titleizedPageTitle(@NotNull @NotNull String title, int pageNum, int pageCount, @NotNull @NotNull List<String> args)
      Forms a page title using , and , and then passes it to titleize(String).

      Default format is configured in Txt.Config.pageTitleFormatMini and looks like:
      Parameters:
      title - The unformatted title, which will be titleized.
      pageNum - The current page number, 1-based (e.g. 1 for the first page).
      pageCount - The total number of pages.
      Returns:
      The titleized page title String.