Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
use return instead of big if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
Tonodus committed Nov 27, 2014
1 parent f347c86 commit e9470b8
Showing 1 changed file with 48 additions and 42 deletions.
90 changes: 48 additions & 42 deletions src/main/java/org/bukkit/material/Lever.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public void setFacingDirection(BlockFace face) {
break;

}

setData(data);
return;
} else if (face == BlockFace.DOWN) {
switch (attach) {
case EAST:
Expand All @@ -129,49 +132,52 @@ public void setFacingDirection(BlockFace face) {
data |= 0x7;
break;
}

setData(data);
return;
}

if (attach == BlockFace.DOWN) {
switch (face) {
case SOUTH:
case NORTH:
data |= 0x5;
break;

case EAST:
case WEST:
data |= 0x6;
break;
}
} else if (attach == BlockFace.UP) {
switch (face) {
case SOUTH:
case NORTH:
data |= 0x7;
break;

case EAST:
case WEST:
data |= 0x0;
break;
}
} else {
if (attach == BlockFace.DOWN) {
switch (face) {
case SOUTH:
case NORTH:
data |= 0x5;
break;

case EAST:
case WEST:
data |= 0x6;
break;
}
} else if (attach == BlockFace.UP) {
switch (face) {
case SOUTH:
case NORTH:
data |= 0x7;
break;

case EAST:
case WEST:
data |= 0x0;
break;
}
} else {
switch (face) {
case EAST:
data |= 0x1;
break;

case WEST:
data |= 0x2;
break;

case SOUTH:
data |= 0x3;
break;

case NORTH:
data |= 0x4;
break;
}
switch (face) {
case EAST:
data |= 0x1;
break;

case WEST:
data |= 0x2;
break;

case SOUTH:
data |= 0x3;
break;

case NORTH:
data |= 0x4;
break;
}
}
setData(data);
Expand Down

0 comments on commit e9470b8

Please sign in to comment.