Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made //undo and //redo disregard global masks.

  • Loading branch information...
commit cfb19eba9b5167ec1267791e5d8e8fe358acdc26 1 parent 144c0a9
@TomyLobo TomyLobo authored
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/main/java/com/sk89q/worldedit/commands/HistoryCommands.java
View
18 src/main/java/com/sk89q/worldedit/commands/HistoryCommands.java
@@ -23,6 +23,7 @@
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldedit.*;
+import com.sk89q.worldedit.masks.Mask;
/**
* History little commands.
@@ -46,8 +47,12 @@ public HistoryCommands(WorldEdit we) {
@CommandPermissions("worldedit.history.undo")
public void undo(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
-
+
int times = Math.max(1, args.getInteger(0, 1));
+
+ Mask mask = session.getMask();
+ session.setMask(null);
+
for (int i = 0; i < times; ++i) {
EditSession undone;
if (args.argsLength() < 2) {
@@ -61,6 +66,7 @@ public void undo(CommandContext args, LocalSession session, LocalPlayer player,
}
undone = sess.undo(session.getBlockBag(player));
}
+
if (undone != null) {
player.print("Undo successful.");
we.flushBlockBag(player, undone);
@@ -69,6 +75,8 @@ public void undo(CommandContext args, LocalSession session, LocalPlayer player,
break;
}
}
+
+ session.setMask(mask);
}
@Command(
@@ -81,9 +89,12 @@ public void undo(CommandContext args, LocalSession session, LocalPlayer player,
@CommandPermissions("worldedit.history.redo")
public void redo(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
-
+
int times = Math.max(1, args.getInteger(0, 1));
+ Mask mask = session.getMask();
+ session.setMask(null);
+
for (int i = 0; i < times; ++i) {
EditSession redone;
if (args.argsLength() < 2) {
@@ -97,6 +108,7 @@ public void redo(CommandContext args, LocalSession session, LocalPlayer player,
}
redone = sess.redo(session.getBlockBag(player));
}
+
if (redone != null) {
player.print("Redo successful.");
we.flushBlockBag(player, redone);
@@ -104,6 +116,8 @@ public void redo(CommandContext args, LocalSession session, LocalPlayer player,
player.printError("Nothing left to redo.");
}
}
+
+ session.setMask(mask);
}
@Command(
Please sign in to comment.
Something went wrong with that request. Please try again.