summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java12
-rw-r--r--Essentials/src/messages.properties3
-rw-r--r--Essentials/src/messages_de.properties3
-rw-r--r--Essentials/src/messages_en.properties3
5 files changed, 20 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
index 2e9096498..246a49116 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
@@ -131,6 +131,10 @@ public class EssentialsBlockListener extends BlockListener
{
String[] l1 = event.getLine(3).split("[ :-]+", 2);
boolean m1 = l1[0].matches("^[^0-9][\\.0-9]+");
+ if (!m1 && l1.length != 2)
+ {
+ throw new Exception(Util.format("invalidSignLine", 4));
+ }
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
if ((int)q1 < 1) throw new Exception(Util.i18n("moreThanZero"));
if (!m1) ItemDb.get(l1[1]);
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java
index 113ad327a..aac9feff1 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java
@@ -182,12 +182,20 @@ public class EssentialsEcoBlockListener extends BlockListener
{
try
{
- String[] l1 = event.getLines()[1].split("[ :-]+");
- String[] l2 = event.getLines()[2].split("[ :-]+");
+ String[] l1 = event.getLine(1).split("[ :-]+");
+ String[] l2 = event.getLine(2).split("[ :-]+");
boolean m1 = l1[0].matches("[^0-9][0-9]+(\\.[0-9]+)?");
boolean m2 = l2[0].matches("[^0-9][0-9]+(\\.[0-9]+)?");
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
double q2 = Double.parseDouble(m2 ? l2[0].substring(1) : l2[0]);
+ if (m1 ? l2.length != 1 : l2.length != 2)
+ {
+ throw new Exception(Util.format("invalidSignLine", 2));
+ }
+ if (m2 ? l2.length != 2 : l2.length != 3)
+ {
+ throw new Exception(Util.format("invalidSignLine", 3));
+ }
double r2 = Double.parseDouble(l2[m2 ? 1 : 2]);
r2 = m2 ? r2 : r2 - r2 % q2;
if ((!m1 & q1 < 1) || (!m2 & q2 < 1) || r2 < 1)
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index ce1542f5f..261c2237e 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -304,4 +304,5 @@ illegalDate = Illegal date format.
timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)?
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Kits: {0}
-loadWarpError = Failed to load warp {0} \ No newline at end of file
+loadWarpError = Failed to load warp {0}
+invalidSignLine = Line {0} on sign is invalid. \ No newline at end of file
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 9e0c12048..65d666c67 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -304,4 +304,5 @@ illegalDate = Ung\u00fcltiges Datumsformat.
timePattern = (?:([0-9]+)\\s*[yj][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[dt][a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:h|st)[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)?
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Ausr\u00fcstungen: {0}
-loadWarpError = Fehler beim Laden von Warp-Punkt {0} \ No newline at end of file
+loadWarpError = Fehler beim Laden von Warp-Punkt {0}
+invalidSignLine = Die Zeile {0} auf dem Schild ist falsch. \ No newline at end of file
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index ce1542f5f..261c2237e 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -304,4 +304,5 @@ illegalDate = Illegal date format.
timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)?
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
kits = \u00a77Kits: {0}
-loadWarpError = Failed to load warp {0} \ No newline at end of file
+loadWarpError = Failed to load warp {0}
+invalidSignLine = Line {0} on sign is invalid. \ No newline at end of file