Class ChatUtils

java.lang.Object
me.sciguymjm.uberenchant.utils.ChatUtils

public class ChatUtils extends Object
A chat-related utility class
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    color(String string)
    Adds color to a string for messages.
    (If using the spigot api or a for of it, hex codes can be used using a #rrggbb ie #ff0000 = red)
    Example formatting:
    static void
    response(org.bukkit.entity.Player player, String[] messages)
    Sends the specified player an array of messages.
    static void
    response(org.bukkit.entity.Player player, String message, Object... args)
    Sends the specified player a formated message.
    Usage:

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ChatUtils

      public ChatUtils()
  • Method Details

    • response

      public static void response(org.bukkit.entity.Player player, String message, Object... args)
      Sends the specified player a formated message.
      Usage:
      
       Playe p = new Player("john_doe"); // Psuedo code
       ChatUtils.response(p, "This is a message for %1$s", p.getName());
       // outputs "[UberEnchant] This is a message for john_doe"
       
      Parameters:
      player - - The player
      message - - The message
      args - - The arguments for the message
    • response

      public static void response(org.bukkit.entity.Player player, String[] messages)
      Sends the specified player an array of messages.
      Parameters:
      player - - The player
      messages - - The array of messages
    • color

      public static String color(String string)
      Adds color to a string for messages.
      (If using the spigot api or a for of it, hex codes can be used using a #rrggbb ie #ff0000 = red)
      Example formatting:
      
       // For bukkit style color codes
       ChatUtils.color("&6&lThis bold gold color");
      
       // For any hex color using rgb
       ChatUtils.color("#ff7700&lThis is bold orange");
       
      Parameters:
      string - - The string to color format
      Returns:
      A color-formatted string