This commit is contained in:
Wizjany
2011-10-26 16:50:46 -04:00
parent 8797d8ac3c
commit 699807665d
19 changed files with 175 additions and 110 deletions

View File

@ -63,6 +63,7 @@ public class GeneralCommands {
@Command(
aliases = { "/fast" },
flags = "l",
usage = "[on|off]",
desc = "Toggle fast mode",
min = 0,
@ -73,25 +74,24 @@ public class GeneralCommands {
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
boolean light = args.hasFlag('f');
String newState = args.getString(0, null);
if (session.hasFastMode()) {
if ("on".equals(newState)) {
player.printError("Fast mode already enabled.");
return;
}
Boolean dir = newState.equals("on") ? true : newState.equals("off") ? false : null;
session.setFastMode(false);
player.print("Fast mode disabled.");
}
else {
if ("off".equals(newState)) {
player.printError("Fast mode already disabled.");
return;
}
boolean hadFast = session.hasFastMode();
boolean hadLight = session.hasFastLighting();
session.setFastMode(true);
player.print("Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes.");
boolean setFast = dir == null ? !hadFast : dir;
boolean setLight = dir == null ? !hadLight : dir;
session.setFastMode(setFast);
if (light) {
session.setFastLighting(setLight);
}
player.print("Fast mode " + (!setFast ? "disabled." :
("enabled. You may need to rejoin to see changes"
+ (setLight ? "and lighting in affected chunks may be wrong." : "."))));
}
@Command(

View File

@ -322,8 +322,7 @@ public class GenerationCommands {
try {
expression = Expression.compile(args.getJoinedStrings(1), "x", "y", "z");
expression.optimize();
}
catch (ExpressionException e) {
} catch (ExpressionException e) {
player.printError(e.getMessage());
return;
}
@ -336,15 +335,13 @@ public class GenerationCommands {
protected boolean isInside(double x, double y, double z) {
try {
return expression.evaluate(x, y, z) > 0;
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
};
}
else if (args.hasFlag('o')) {
} else if (args.hasFlag('o')) {
final Vector placement = session.getPlacementPosition(player);
final double placementX = placement.getX();
@ -356,15 +353,13 @@ public class GenerationCommands {
protected boolean isInside(double x, double y, double z) {
try {
return expression.evaluate(x - placementX, y - placementY, z - placementZ) > 0;
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
};
}
else {
} else {
final Vector min = region.getMinimumPoint();
final Vector max = region.getMaximumPoint();
final Vector center = max.add(min).multiply(0.5);
@ -376,8 +371,7 @@ public class GenerationCommands {
try {
return expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ()) > 0;
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
return false;
}

View File

@ -194,8 +194,7 @@ public class SelectionCommands {
player.print("Chunks selected: ("
+ min2D.getBlockX() + ", " + min2D.getBlockZ() + ") - ("
+ max2D.getBlockX() + ", " + max2D.getBlockZ() + ")");
}
else {
} else {
final Vector2D min2D = ChunkStore.toChunk(player.getBlockIn());
min = new Vector(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);

View File

@ -54,8 +54,7 @@ public class ToolUtilCommands {
session.disableSuperPickAxe();
player.print("Super pick axe disabled.");
}
else {
} else {
if ("off".equals(newState)) {
player.printError("Super pick axe already disabled.");
return;