1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-21 14:03:54 +02:00

Throw invalid kit message on invalid delay

This commit is contained in:
Necrodoom
2013-04-30 20:03:54 +03:00
committed by KHobbits
parent 7646dffc17
commit 819ae51980

View File

@@ -59,7 +59,16 @@ public class Kit
final Calendar time = new GregorianCalendar(); final Calendar time = new GregorianCalendar();
// Take the current time, and remove the delay from it. // 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(); final Calendar earliestTime = new GregorianCalendar();
earliestTime.add(Calendar.SECOND, -(int)delay); earliestTime.add(Calendar.SECOND, -(int)delay);
earliestTime.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0)); earliestTime.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0));