diff --git a/src/main/java/com/sk89q/worldedit/EditSession.java b/src/main/java/com/sk89q/worldedit/EditSession.java index 9b617db64..fd2da128a 100644 --- a/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/src/main/java/com/sk89q/worldedit/EditSession.java @@ -100,11 +100,6 @@ public class EditSession { */ private boolean fastMode = false; - /** - * Use fast lighting as well if using fast mode. - */ - private boolean fastLighting = false; - /** * Block bag to use for getting blocks. */ @@ -214,13 +209,13 @@ public class EditSession { if (BlockType.usesData(type)) { if (fastMode) { - result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0, fastLighting); + result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0); } else { result = world.setTypeIdAndData(pt, type, block.getData() > -1 ? block.getData() : 0); } } else { if (fastMode) { - result = world.setBlockTypeFast(pt, type, fastLighting); + result = world.setBlockTypeFast(pt, type); } else { result = world.setBlockType(pt, type); } @@ -532,24 +527,6 @@ public class EditSession { queued = false; } - /** - * Set fast lighting. - * - * @param fastLighting - */ - public void setFastLighting(boolean fastLighting) { - this.fastLighting = fastLighting; - } - - /** - * Return fast lighting status. - * - * @return - */ - public boolean hasFastLighting() { - return fastLighting; - } - /** * Set fast mode. * diff --git a/src/main/java/com/sk89q/worldedit/LocalSession.java b/src/main/java/com/sk89q/worldedit/LocalSession.java index 0873bed7f..8e5e0c0db 100644 --- a/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -73,7 +73,6 @@ public class LocalSession { private boolean beenToldVersion = false; private boolean hasCUISupport = false; private boolean fastMode = false; - private boolean fastLighting = false; private Mask mask; private TimeZone timezone = TimeZone.getDefault(); private Boolean jumptoBlock = true; @@ -645,7 +644,6 @@ public class LocalSession { new EditSession(player.getWorld(), getBlockChangeLimit(), blockBag); editSession.setFastMode(fastMode); - editSession.setFastLighting(fastLighting); editSession.setMask(mask); return editSession; @@ -669,24 +667,6 @@ public class LocalSession { this.fastMode = fastMode; } - /** - * Checks if the session has fast lighting enabled. - * - * @return - */ - public boolean hasFastLighting() { - return fastLighting; - } - - /** - * Set fast lighting. - * - * @param fastLighting - */ - public void setFastLighting(boolean fastLighting) { - this.fastLighting = fastLighting; - } - /** * Get the mask. * diff --git a/src/main/java/com/sk89q/worldedit/LocalWorld.java b/src/main/java/com/sk89q/worldedit/LocalWorld.java index 8554b3823..7a1c4a1ff 100644 --- a/src/main/java/com/sk89q/worldedit/LocalWorld.java +++ b/src/main/java/com/sk89q/worldedit/LocalWorld.java @@ -63,10 +63,6 @@ public abstract class LocalWorld { return setBlockType(pt, type); } - public boolean setBlockTypeFast(Vector pt, int type, boolean fastLighting) { - return setBlockTypeFast(pt, type); - } - /** * Get block type. * @@ -118,10 +114,6 @@ public abstract class LocalWorld { return ret; } - public boolean setTypeIdAndDataFast(Vector pt, int type, int data, boolean fastLighting) { - return setTypeIdAndDataFast(pt, type, data); - } - /** * Get block data. * diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index a266705e8..b222b864c 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -111,21 +111,8 @@ public class BukkitWorld extends LocalWorld { */ @Override public boolean setBlockTypeFast(Vector pt, int type) { - return setBlockTypeFast(pt, type, false); - } - - /** - * Set block type. - * - * @param pt - * @param type - * @param fastLighting - * @return - */ - @Override - public boolean setBlockTypeFast(Vector pt, int type, boolean fastLighting) { final Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); - if (fastLightingAvailable && fastLighting) { + if (fastLightingAvailable) { type = type & 255; final int previousOpacity = Block_lightOpacity[type]; Block_lightOpacity[type] = 0; @@ -158,13 +145,8 @@ public class BukkitWorld extends LocalWorld { */ @Override public boolean setTypeIdAndDataFast(Vector pt, int type, int data){ - return setTypeIdAndDataFast(pt, type, data, false); - } - - @Override - public boolean setTypeIdAndDataFast(Vector pt, int type, int data, boolean fastLighting) { final Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); - if (fastLightingAvailable && fastLighting) { + if (fastLightingAvailable) { type = type & 255; final int previousOpacity = Block_lightOpacity[type]; Block_lightOpacity[type] = 0; diff --git a/src/main/java/com/sk89q/worldedit/commands/GeneralCommands.java b/src/main/java/com/sk89q/worldedit/commands/GeneralCommands.java index 45d5015b7..653346dee 100644 --- a/src/main/java/com/sk89q/worldedit/commands/GeneralCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/GeneralCommands.java @@ -63,7 +63,6 @@ public class GeneralCommands { @Command( aliases = { "/fast" }, - flags = "l", usage = "[on|off]", desc = "Toggle fast mode", min = 0, @@ -74,24 +73,24 @@ public class GeneralCommands { LocalSession session, LocalPlayer player, EditSession editSession) throws WorldEditException { - boolean light = args.hasFlag('f'); String newState = args.getString(0, null); - Boolean dir = newState == null ? null : newState.equals("on") ? true : newState.equals("off") ? false : null; + if (session.hasFastMode()) { + if ("on".equals(newState)) { + player.printError("Fast mode already enabled."); + return; + } - boolean hadFast = session.hasFastMode(); - boolean hadLight = session.hasFastLighting(); + session.setFastMode(false); + player.print("Fast mode disabled."); + } else { + if ("off".equals(newState)) { + player.printError("Fast mode already disabled."); + return; + } - boolean setFast = dir == null ? !hadFast : dir; - boolean setLight = dir == null ? !hadLight : dir; - - session.setFastMode(setFast); - if (light) { - session.setFastLighting(setLight); + 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."); } - - player.print("Fast mode " + (setFast == hadFast ? "already " : "") + (!setFast ? "disabled." : - ("enabled. You may need to rejoin to see changes" - + (setLight ? "and lighting in affected chunks may be wrong." : ".")))); } @Command(