Skip to content

Commit

Permalink
improve location add/sub matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 20, 2020
1 parent f50dea6 commit 7d4713f
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -2459,15 +2459,15 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext
}
String[] ints = attribute.getContext(1).replace("l@", "").split(",", 4); // TODO: Just LocationTag.valueOf?
if (ints.length >= 3) {
if ((ArgumentHelper.matchesDouble(ints[0]) || ArgumentHelper.matchesInteger(ints[0]))
&& (ArgumentHelper.matchesDouble(ints[1]) || ArgumentHelper.matchesInteger(ints[1]))
&& (ArgumentHelper.matchesDouble(ints[2]) || ArgumentHelper.matchesInteger(ints[2]))) {
if (ArgumentHelper.matchesDouble(ints[0])
&& ArgumentHelper.matchesDouble(ints[1])
&& ArgumentHelper.matchesDouble(ints[2])) {
return new LocationTag(object.clone().add(Double.valueOf(ints[0]),
Double.valueOf(ints[1]),
Double.valueOf(ints[2])));
}
}
else if (LocationTag.matches(attribute.getContext(1))) {
if (LocationTag.matches(attribute.getContext(1))) {
return new LocationTag(object.clone().add(LocationTag.valueOf(attribute.getContext(1))));
}
return null;
Expand All @@ -2485,15 +2485,15 @@ else if (LocationTag.matches(attribute.getContext(1))) {
}
String[] ints = attribute.getContext(1).replace("l@", "").split(",", 4); // TODO: Just LocationTag.valueOf?
if (ints.length == 3 || ints.length == 4) {
if ((ArgumentHelper.matchesDouble(ints[0]) || ArgumentHelper.matchesInteger(ints[0]))
&& (ArgumentHelper.matchesDouble(ints[1]) || ArgumentHelper.matchesInteger(ints[1]))
&& (ArgumentHelper.matchesDouble(ints[2]) || ArgumentHelper.matchesInteger(ints[2]))) {
if (ArgumentHelper.matchesDouble(ints[0])
&& ArgumentHelper.matchesDouble(ints[1])
&& ArgumentHelper.matchesDouble(ints[2])) {
return new LocationTag(object.clone().subtract(Double.valueOf(ints[0]),
Double.valueOf(ints[1]),
Double.valueOf(ints[2])));
}
}
else if (LocationTag.matches(attribute.getContext(1))) {
if (LocationTag.matches(attribute.getContext(1))) {
return new LocationTag(object.clone().subtract(LocationTag.valueOf(attribute.getContext(1))));
}
return null;
Expand Down

0 comments on commit 7d4713f

Please sign in to comment.