fix the server thinking it's the next week

This commit is contained in:
xXVevzZXx 2016-07-17 09:34:56 +02:00 committed by cnr
parent 0ae4b0c5e0
commit 370b0693d9

View File

@ -154,7 +154,7 @@ public class ServerUptimeManager implements Listener
{
Date end = _dates.get(start);
Date current = new Date(System.currentTimeMillis());
if (current.before(end) && current.after(start))
return true;
}
@ -182,6 +182,18 @@ public class ServerUptimeManager implements Listener
{
GregorianCalendar firstDate = new GregorianCalendar();
GregorianCalendar secondDate = new GregorianCalendar();
if (firstDate.get(GregorianCalendar.DAY_OF_WEEK) == 1)
{
int week = firstDate.get(GregorianCalendar.WEEK_OF_YEAR) - 1;
if (week == 0)
{
week = Calendar.getInstance().getMaximum(Calendar.WEEK_OF_YEAR);
}
firstDate.set(GregorianCalendar.WEEK_OF_YEAR, week);
secondDate.set(GregorianCalendar.WEEK_OF_YEAR, week);
}
int i = 0;
for (String part : pair.split("-"))