Utils.java 723 B

1234567891011121314151617181920212223242526272829303132
  1. package de.Linus122.TimeIsMoney.tools;
  2. import org.bukkit.ChatColor;
  3. /**
  4. * Utility class.
  5. *
  6. * @author Linus122
  7. * @since 1.9.6.1
  8. */
  9. public class Utils {
  10. /**
  11. * @throws RuntimeException utils class should not be instantiated.
  12. */
  13. public Utils() {
  14. throw new RuntimeException("Utils class should not be instantiated!");
  15. }
  16. /**
  17. * Converts &color to {@link org.bukkit.ChatColor}.
  18. *
  19. * @param s The string to convert to {@link org.bukkit.ChatColor}.
  20. * @return The converted string with {@link org.bukkit.ChatColor}.
  21. */
  22. public static String CC(String s) {
  23. // return an empty string if given string is null
  24. if(s == null) {
  25. return "";
  26. }
  27. return ChatColor.translateAlternateColorCodes('&', s);
  28. }
  29. }