Skip to content

Commit

Permalink
make cuboid valueOf not error with debug off
Browse files Browse the repository at this point in the history
Ideally we'd have a fallback check here but... that's just not available in the D1 setup... yet another reason D2 is better!
  • Loading branch information
mcmonkey4eva committed Mar 26, 2018
1 parent d87ea02 commit 992b24c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dCuboid.java
Expand Up @@ -93,7 +93,9 @@ public static dCuboid valueOf(String string, TagContext context) {
&& dLocation.matches(positions.get(0))
&& dLocation.matches(positions.get(1))) {
if (positions.size() % 2 != 0) {
dB.echoError("valueOf dCuboid returning null (Uneven number of locations): '" + string + "'.");
if (context == null || context.debug) {
dB.echoError("valueOf dCuboid returning null (Uneven number of locations): '" + string + "'.");
}
return null;
}

Expand All @@ -107,12 +109,16 @@ public static dCuboid valueOf(String string, TagContext context) {

// Must be valid locations
if (pos_1 == null || pos_2 == null) {
dB.echoError("valueOf in dCuboid returning null (null locations): '" + string + "'.");
if (context == null || context.debug) {
dB.echoError("valueOf in dCuboid returning null (null locations): '" + string + "'.");
}
return null;
}
// Must have valid worlds
if (pos_1.getWorld() == null || pos_2.getWorld() == null) {
dB.echoError("valueOf in dCuboid returning null (null worlds): '" + string + "'.");
if (context == null || context.debug) {
dB.echoError("valueOf in dCuboid returning null (null worlds): '" + string + "'.");
}
return null;
}
toReturn.addPair(pos_1, pos_2);
Expand All @@ -134,7 +140,9 @@ public static dCuboid valueOf(String string, TagContext context) {
return (dCuboid) NotableManager.getSavedObject(m.group(2));
}

dB.echoError("valueOf dCuboid returning null: " + string);
if (context == null || context.debug) {
dB.echoError("valueOf dCuboid returning null: " + string);
}

return null;
}
Expand Down

0 comments on commit 992b24c

Please sign in to comment.