APIv4, support for spigot 1.12 (and up) #6
@ -16,10 +16,10 @@ import com.redstoner.coremods.debugger.Debugger;
|
|||||||
/** The utils class containing utility functions. Those include but are not limited to sending formatted messages, broadcasts and more.
|
/** The utils class containing utility functions. Those include but are not limited to sending formatted messages, broadcasts and more.
|
||||||
*
|
*
|
||||||
* @author Pepich */
|
* @author Pepich */
|
||||||
@Version(major = 4, minor = 0, revision = 1, compatible = 1)
|
@Version(major = 4, minor = 0, revision = 2, compatible = 1)
|
||||||
public final class Utils
|
public final class Utils
|
||||||
{
|
{
|
||||||
/** The SimpleDateFormat used for getting the current date. */
|
/** The @SimpleDateFormat used for getting the current date. */
|
||||||
public static SimpleDateFormat dateFormat = new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss]");
|
public static SimpleDateFormat dateFormat = new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss]");
|
||||||
|
|
||||||
/** Hidden constructor. Do not instantiate UTILS classes! :) */
|
/** Hidden constructor. Do not instantiate UTILS classes! :) */
|
||||||
@ -241,10 +241,10 @@ public final class Utils
|
|||||||
return dateFormat.format(date);
|
return dateFormat.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provides a uniform way of getting the (display)name of a CommandSender.
|
/** Provides a uniform way of getting the (display)name of a @CommandSender.
|
||||||
*
|
*
|
||||||
* @param sender The CommandSender to get the name of.
|
* @param sender The @CommandSender to get the name of.
|
||||||
* @return The DisplayName of the CommandSender or if not a player, the name in blue. */
|
* @return The DisplayName of the @CommandSender or if not a @Player, the name in blue. */
|
||||||
public static String getName(CommandSender sender)
|
public static String getName(CommandSender sender)
|
||||||
{
|
{
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
@ -253,6 +253,20 @@ public final class Utils
|
|||||||
return "§9" + sender.getName();
|
return "§9" + sender.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Provides a uniform way of getting the UUID of a @CommandSender.
|
||||||
|
*
|
||||||
|
* @param sender The @CommandSender to get the UUID of.
|
||||||
|
* @return The UUID of the @CommandSender or if not a player, "CONSOLE" in blue. */
|
||||||
|
public static String getID(CommandSender sender)
|
||||||
|
{
|
||||||
|
String id;
|
||||||
|
if (sender instanceof Player)
|
||||||
|
id = ((Player) sender).getUniqueId().toString();
|
||||||
|
else
|
||||||
|
id = "CONSOLE";
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
/** This method "colorifies" a message.
|
/** This method "colorifies" a message.
|
||||||
*
|
*
|
||||||
* @param message the message to be colored.
|
* @param message the message to be colored.
|
||||||
@ -265,7 +279,7 @@ public final class Utils
|
|||||||
/** This method "colorifies" a message using proper permissions.
|
/** This method "colorifies" a message using proper permissions.
|
||||||
*
|
*
|
||||||
* @param message the message to be colored.
|
* @param message the message to be colored.
|
||||||
* @param sender the command sender whose permissions shall be applied.
|
* @param sender the @CommandSender whose permissions shall be applied.
|
||||||
* @return the colorified message. */
|
* @return the colorified message. */
|
||||||
public static String colorify(String message, CommandSender sender, char alternateColorcode)
|
public static String colorify(String message, CommandSender sender, char alternateColorcode)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user