public class TimeParser extends Object
player.sendMessage(new TimeParser(56981).formatTime())
You can also have custom keys creating a new instance of the TimeKeys object.
TimeKeys keys = new TimeKeys();
// Here I'm changing the splitter.
keys = keys.setSplitter("; ");
// Then I set it on an instance of TimeParser.
TimeParser parser = new TimeParser(keys, 2132);
| Modifier and Type | Field and Description |
|---|---|
static int |
DAY
The seconds that are stored in a day.
|
static int |
HOUR
The seconds that are stored in an hour.
|
static int |
MINUTE
The seconds that are stored in a minute.
|
static int |
MONTH
The seconds that are stored in a month.
|
static int |
WEEK
The seconds that are stored in a week.
|
static int |
YEAR
The seconds that are stored in a year.
|
| Constructor and Description |
|---|
TimeParser(long seconds)
Creates a new parser using an amount of seconds.
|
TimeParser(TimeKeys keys,
long seconds)
Creates a new parser using a
TimeKeys instance and an amount of seconds. |
| Modifier and Type | Method and Description |
|---|---|
String |
formatTime()
Takes in a value in seconds and returns a very nicely formatted string
that can contain seconds, minutes, hours, days, weeks, months and years.
|
String |
formatTime(org.bukkit.entity.Player parser)
Takes in a value in seconds and returns a very nicely formatted string
that can contain seconds, minutes, hours, days, weeks, months and years.
|
public static final int MINUTE
public static final int HOUR
public static final int DAY
public static final int WEEK
public static final int MONTH
public static final int YEAR
public TimeParser(TimeKeys keys, long seconds)
TimeKeys instance and an amount of seconds.keys - a TimeKeys instanceseconds - time in secondspublic TimeParser(long seconds)
seconds - time in secondspublic String formatTime(org.bukkit.entity.Player parser)
parser - a player to parse colors and placeholderspublic String formatTime()
Copyright © 2023. All rights reserved.