Catch all values greater than 10 years to avoid exploits.

This commit is contained in:
KHobbits 2012-04-04 02:07:01 +01:00
parent eeea16a99a
commit 2b99ed9a2a

View file

@ -187,10 +187,6 @@ public class Util
throw new Exception(_("illegalDate"));
}
Calendar c = new GregorianCalendar();
if (years > 10)
{
years = 10;
}
if (years > 0)
{
c.add(Calendar.YEAR, years * (future ? 1 : -1));
@ -219,6 +215,12 @@ public class Util
{
c.add(Calendar.SECOND, seconds * (future ? 1 : -1));
}
Calendar max = new GregorianCalendar();
max.add(Calendar.YEAR, 10);
if (c.after(max)) {
return max.getTimeInMillis();
}
return c.getTimeInMillis();
}
// The player can stand inside these materials