Class ChatUtils

java.lang.Object
io.github.thebusybiscuit.slimefun4.utils.ChatUtils

public final class ChatUtils extends Object
This utility class contains a few static methods that are all about String manipulation or sending a String to a Player.
Author:
TheBusyBiscuit
  • Method Details

    • sendURL

      public static void sendURL(@Nonnull CommandSender sender, @Nonnull String url)
    • removeColorCodes

      @Nonnull public static String removeColorCodes(@Nonnull String string)
    • crop

      @Nonnull public static String crop(@Nonnull ChatColor color, @Nonnull String string)
    • christmas

      @Nonnull public static String christmas(@Nonnull String text)
    • awaitInput

      public static void awaitInput(@Nonnull Player p, @Nonnull Consumer<String> callback)
    • humanize

      @Nonnull public static String humanize(@Nonnull String string)
      This converts a given String to a human-friendly version. This can be used to convert enum constants to easier to read words with spaces and upper case word starts. For example: ENUM_CONSTANT: Enum Constant
      Parameters:
      string - The String to convert
      Returns:
      A human-friendly version of the given String
    • checkPlurality

      @Nonnull public static String checkPlurality(@Nonnull String string, int count)
      This method adds an s to a string if the supplied integer is not 1.
      Parameters:
      string - The string to potentially pluralize
      count - The amount of things
      Returns:
      string if count is 1 else string + "s"
      Throws:
      IllegalArgumentException - if count is less than 0