summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-04-04 01:55:06 +0100
committerKHobbits <rob@khobbits.co.uk>2012-04-04 01:55:06 +0100
commiteeea16a99aece0b53a76f11a72879ce8b7a6ef5e (patch)
tree2ffb190ffe9b0459900a51c62730ec69dd6868c8
parente52996609afd24a9795358173c487cd9e0e67528 (diff)
downloadEssentials-eeea16a99aece0b53a76f11a72879ce8b7a6ef5e.tar
Essentials-eeea16a99aece0b53a76f11a72879ce8b7a6ef5e.tar.gz
Essentials-eeea16a99aece0b53a76f11a72879ce8b7a6ef5e.tar.lz
Essentials-eeea16a99aece0b53a76f11a72879ce8b7a6ef5e.tar.xz
Essentials-eeea16a99aece0b53a76f11a72879ce8b7a6ef5e.zip
Cap mute/ban/jail to 10 years (any more is silly).
Cap time descriptions to 3 significant notions.
-rw-r--r--Essentials/src/com/earth2me/essentials/Util.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java
index 0070a5a6a..78f31542c 100644
--- a/Essentials/src/com/earth2me/essentials/Util.java
+++ b/Essentials/src/com/earth2me/essentials/Util.java
@@ -80,11 +80,17 @@ public class Util
_("second"),
_("seconds")
};
+ int accuracy = 0;
for (int i = 0; i < types.length; i++)
{
+ if (accuracy > 2)
+ {
+ break;
+ }
int diff = dateDiff(types[i], fromDate, toDate, future);
if (diff > 0)
{
+ accuracy++;
sb.append(" ").append(diff).append(" ").append(names[i * 2 + (diff > 1 ? 1 : 0)]);
}
}
@@ -92,7 +98,7 @@ public class Util
{
return "now";
}
- return sb.toString();
+ return sb.toString().trim();
}
private static int dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future)
@@ -181,6 +187,10 @@ 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));
@@ -250,7 +260,7 @@ public class Util
AIR_MATERIALS.add(Material.PUMPKIN_STEM.getId());
AIR_MATERIALS.add(Material.MELON_STEM.getId());
AIR_MATERIALS.add(Material.VINE.getId());
- AIR_MATERIALS.add(Material.FENCE_GATE.getId());
+ AIR_MATERIALS.add(Material.FENCE_GATE.getId());
AIR_MATERIALS.add(Material.WATER_LILY.getId());
AIR_MATERIALS.add(Material.NETHER_FENCE.getId());
AIR_MATERIALS.add(Material.NETHER_WARTS.getId());