0

Added getDate method

This commit is contained in:
Pepich
2017-03-10 15:54:51 +01:00
parent f2631772d1
commit 4df0754970
2 changed files with 130 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
package com.redstoner.misc;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -13,9 +16,12 @@ import net.md_5.bungee.api.ChatColor;
/** The utils class containing utility functions. Those include but are not limited to sending formatted messages, broadcasts and more.
*
* @author Pepich */
@Version(major = 1, minor = 2, revision = 10, compatible = 1)
@Version(major = 1, minor = 2, revision = 11, compatible = 1)
public final class Utils
{
/** The SimpleDateFormat used for getting the current date. */
public static SimpleDateFormat dateFormat = new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss]");
/** Hidden constructor. Do not instantiate UTILS classes! :) */
private Utils()
{}
@@ -216,4 +222,13 @@ public final class Utils
{
recipient.sendMessage("§2--=[ " + getCaller() + " ]=--");
}
/** Provides a uniform way of getting the date for all modules.
*
* @return The current date in the format "[dd-mm-yyyy hh:mm:ss]" */
public static String getDate()
{
Date date = new Date(System.currentTimeMillis());
return dateFormat.format(date);
}
}