Permalink
Browse files

BounceBLocks auto-block fixes.

  • Loading branch information...
me4502 committed Feb 27, 2017
1 parent 18e5059 commit 76b05b41dbcf15f7c2430c1b9e6089af8c684d4d
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/main/java/com/sk89q/craftbook/mechanics/BounceBlocks.java
@@ -49,11 +49,15 @@ public void loadConfiguration (YAMLProcessor config, String path) {
double x = 0,y = 0,z = 0;
String[] bits = RegexUtil.COMMA_PATTERN.split(config.getString(path + "auto-blocks." + key));
- if(bits.length == 0)
+ if (bits.length == 0) {
y = 0.5;
- if(bits.length == 1)
- y = Double.parseDouble(bits[0]);
- else {
+ } else if (bits.length == 1) {
+ try {
+ y = Double.parseDouble(bits[0]);
+ } catch (NumberFormatException e) {
+ y = 0.5;
+ }
+ } else {
x = Double.parseDouble(bits[0]);
y = Double.parseDouble(bits[1]);
z = Double.parseDouble(bits[2]);
@@ -96,7 +100,7 @@ public void onPlayerMove(final PlayerMoveEvent event) {
String[] bits = RegexUtil.COMMA_PATTERN.split(StringUtils.replace(s.getLine(2), "!", ""));
if (bits.length == 0) {
y = 0.5;
- } if (bits.length == 1) {
+ } else if (bits.length == 1) {
try {
y = Double.parseDouble(bits[0]);
} catch (NumberFormatException e) {

0 comments on commit 76b05b4

Please sign in to comment.