mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-03 19:56:40 +00:00
Cleanup
This commit is contained in:
@ -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(
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user