mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-02 10:36:39 +00:00
Throw invalid kit message on invalid delay
This commit is contained in:
parent
479dad9966
commit
a65d0db57d
1 changed files with 10 additions and 1 deletions
|
@ -59,7 +59,16 @@ public class Kit
|
|||
final Calendar time = new GregorianCalendar();
|
||||
|
||||
// Take the current time, and remove the delay from it.
|
||||
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0.0d;
|
||||
double delay = 0;
|
||||
try
|
||||
{
|
||||
// Also make sure delay is valid
|
||||
delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0.0d;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception(_("kitError2"));
|
||||
}
|
||||
final Calendar earliestTime = new GregorianCalendar();
|
||||
earliestTime.add(Calendar.SECOND, -(int)delay);
|
||||
earliestTime.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue