3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 19:10:07 +01:00

Cleaned up WorldEdit.getFlipDirection.

Dieser Commit ist enthalten in:
TomyLobo 2011-09-04 23:18:37 +02:00
Ursprung e4cd6c23b6
Commit bb2f8bb350

Datei anzeigen

@ -829,8 +829,7 @@ public class WorldEdit {
} }
/** /**
* Get the flip direction for a player's direction. May return * Get the flip direction for a player's direction.
* null if a direction could not be found.
* *
* @param player * @param player
* @param dirStr * @param dirStr
@ -840,26 +839,42 @@ public class WorldEdit {
public CuboidClipboard.FlipDirection getFlipDirection( public CuboidClipboard.FlipDirection getFlipDirection(
LocalPlayer player, String dirStr) LocalPlayer player, String dirStr)
throws UnknownDirectionException { throws UnknownDirectionException {
PlayerDirection dir = null;
if (dirStr.equals("me")) { if (dirStr.equals("me")) {
dir = player.getCardinalDirection(); final PlayerDirection dir = player.getCardinalDirection();
switch (dir) {
case WEST:
case EAST:
return CuboidClipboard.FlipDirection.WEST_EAST;
case NORTH:
case SOUTH:
return CuboidClipboard.FlipDirection.NORTH_SOUTH;
case UP:
case DOWN:
return CuboidClipboard.FlipDirection.UP_DOWN;
default:
throw new UnknownDirectionException(dir.name());
}
} }
if (dirStr.charAt(0) == 'w' || dir == PlayerDirection.WEST) { switch (dirStr.charAt(0)) {
case 'w':
case 'e':
return CuboidClipboard.FlipDirection.WEST_EAST; return CuboidClipboard.FlipDirection.WEST_EAST;
} else if (dirStr.charAt(0) == 'e' || dir == PlayerDirection.EAST) {
return CuboidClipboard.FlipDirection.WEST_EAST; case 'n':
} else if (dirStr.charAt(0) == 's' || dir == PlayerDirection.SOUTH) { case 's':
return CuboidClipboard.FlipDirection.NORTH_SOUTH; return CuboidClipboard.FlipDirection.NORTH_SOUTH;
} else if (dirStr.charAt(0) == 'n' || dir == PlayerDirection.NORTH) {
return CuboidClipboard.FlipDirection.NORTH_SOUTH; case 'u':
} else if (dirStr.charAt(0) == 'u' || dir == PlayerDirection.UP) { case 'd':
return CuboidClipboard.FlipDirection.UP_DOWN; return CuboidClipboard.FlipDirection.UP_DOWN;
} else if (dirStr.charAt(0) == 'd' || dir == PlayerDirection.DOWN) {
return CuboidClipboard.FlipDirection.UP_DOWN; default:
} else { throw new UnknownDirectionException(dirStr);
throw new UnknownDirectionException(dir.name());
} }
} }