Adds most of the code necessary for #11

This commit is contained in:
2022-10-14 21:45:57 +02:00
parent 0c6a28d7df
commit 0357de1cf7
10 changed files with 404 additions and 28 deletions

View File

@ -0,0 +1,65 @@
package net.knarcraft.blacksmith.formatting;
/**
* The important intervals when not using exact wait times
*/
public enum TimeInterval {
/**
* Less than 10 seconds left
*/
INTERVAL_LESS_THAN_10_SECONDS("momentarily", 10),
/**
* Less than 30 seconds left
*/
INTERVAL_LESS_THAN_30_SECONDS("in a little while", 30),
/**
* Less than 1 minute left
*/
INTERVAL_LESS_THAN_1_MINUTE("in a while", 60),
/**
* Less than 5 minutes left
*/
INTERVAL_LESS_THAN_5_MINUTES("after some time", 300),
/**
* More than 5 minutes left
*/
INTERVAL_MORE_THAN_5_MINUTES("in quite a while", Integer.MAX_VALUE);
private final String defaultText;
private final int maxSeconds;
/**
* Instantiates a new time interval
*
* @param defaultText <p>The default text used to describe the time interval</p>
* @param maxSeconds <p>The maximum number of seconds to fall within this interval</p>
*/
TimeInterval(String defaultText, int maxSeconds) {
this.defaultText = defaultText;
this.maxSeconds = maxSeconds;
}
/**
* Gets the default text to display for this interval
*
* @return <p>The default text to display for this interval</p>
*/
public String getDefaultText() {
return this.defaultText;
}
/**
* Gets the maximum number of seconds before exceeding this interval
*
* @return <p>The max seconds of this interval</p>
*/
public int getIntervalMax() {
return maxSeconds;
}
}