From 2b99ed9a2a6d0894ea6bf121c1bdba17e8524e47 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Wed, 4 Apr 2012 02:07:01 +0100 Subject: [PATCH] Catch all values greater than 10 years to avoid exploits. --- Essentials/src/com/earth2me/essentials/Util.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index 78f31542c..73817f645 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -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