Changes tabs to spaces, also removed extra boolean.

This commit is contained in:
Jeremy Koletar 2011-07-07 12:35:08 -05:00
parent fce942e130
commit 6b9dbe349a

View File

@ -57,28 +57,24 @@ public class NavigationCommands {
public static void ascend(CommandContext args, WorldEdit we, public static void ascend(CommandContext args, WorldEdit we,
LocalSession session, LocalPlayer player, EditSession editSession) LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException {
if (args.argsLength() == 0) { if (args.argsLength() == 0) {
if (player.ascendLevel()) { if (player.ascendLevel()) {
player.print("Ascended a level."); player.print("Ascended a level.");
} else { } else {
player.printError("No free spot above you found."); player.printError("No free spot above you found.");
} }
} else { } else {
Boolean ascentDone = false; Boolean ascentDone = false;
int ascentLevels = 1; int ascentLevels = 1;
int levelsToAscend = args.getInteger(0); int levelsToAscend = args.getInteger(0);
while (!ascentDone) { while (player.ascendLevel() && levelsToAscend != ascentLevels) {
if (player.ascendLevel() && levelsToAscend != ascentLevels) { ascentLevels++;
ascentLevels++; }
} else { if (ascentLevels == 0) {
ascentDone = true; player.printError("No free spot above you found.");
} } else {
} player.print("Ascended " + Integer.toString(ascentLevels) + " levels.");
if (ascentLevels == 0) { }
player.printError("No free spot above you found.");
} else {
player.print("Ascended " + Integer.toString(ascentLevels) + " levels.");
}
} }
} }
@ -94,28 +90,23 @@ public class NavigationCommands {
LocalSession session, LocalPlayer player, EditSession editSession) LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException {
if (args.argsLength() == 0) { if (args.argsLength() == 0) {
if (player.descendLevel()) { if (player.descendLevel()) {
player.print("Descended a level."); player.print("Descended a level.");
} else { } else {
player.printError("No free spot above you found."); player.printError("No free spot above you found.");
} }
} else { } else {
Boolean descentDone = false; int descentLevels = 1;
int descentLevels = 1; int levelsToDescend = args.getInteger(0);
int levelsToDescend = args.getInteger(0); while (player.descendLevel() && levelsToDescend != descentLevels) {
while (!descentDone) { descentLevels++;
if (player.descendLevel() && levelsToDescend != descentLevels) { }
descentLevels++; if (descentLevels == 0) {
} else { player.printError("No free spot above you found.");
descentDone = true; } else {
} player.print("Descended " + Integer.toString(descentLevels) + " levels.");
} }
if (descentLevels == 0) {
player.printError("No free spot above you found.");
} else {
player.print("Descended " + Integer.toString(descentLevels) + " levels.");
}
} }
} }