mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Fix array out of bounds exception handling on warp and trade signs.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1528 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
15142c0ead
commit
b642273f60
5 changed files with 20 additions and 5 deletions
|
@ -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]);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -305,3 +305,4 @@ timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:
|
|||
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
|
||||
kits = \u00a77Kits: {0}
|
||||
loadWarpError = Failed to load warp {0}
|
||||
invalidSignLine = Line {0} on sign is invalid.
|
|
@ -305,3 +305,4 @@ timePattern = (?:([0-9]+)\\s*[yj][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?
|
|||
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
|
||||
kits = \u00a77Ausr\u00fcstungen: {0}
|
||||
loadWarpError = Fehler beim Laden von Warp-Punkt {0}
|
||||
invalidSignLine = Die Zeile {0} auf dem Schild ist falsch.
|
|
@ -305,3 +305,4 @@ timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:
|
|||
msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2}
|
||||
kits = \u00a77Kits: {0}
|
||||
loadWarpError = Failed to load warp {0}
|
||||
invalidSignLine = Line {0} on sign is invalid.
|
Loading…
Reference in a new issue