From f7cdae5e56cd3d231c3e09803054b6ce52a3cee8 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 6 Apr 2019 00:53:00 +1100 Subject: [PATCH] Disable undo if fastmode --- worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java | 1 + .../java/com/sk89q/worldedit/command/HistoryCommands.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java b/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java index 57fc2d9b1..c4982a2a9 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/config/BBC.java @@ -93,6 +93,7 @@ public enum BBC { COMMAND_HISTORY_OTHER_ERROR("Unable to find session for %s0.", "WorldEdit.History"), COMMAND_REDO_SUCCESS("Redo successful%s0.", "WorldEdit.History"), COMMAND_UNDO_ERROR("Nothing left to undo. (See also `/inspect` and `/frb`)", "WorldEdit.History"), + COMMAND_UNDO_DISABLED("Undo disabled, use: //fast", "WorldEdit.History"), COMMAND_UNDO_SUCCESS("Undo successful%s0.", "WorldEdit.History"), OPERATION("Operation queued (%s0)", "WorldEdit.Operation"), diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java index a545e2513..072a957c4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java @@ -227,6 +227,10 @@ public class HistoryCommands extends MethodCommands { ) @CommandPermissions("worldedit.history.undo") public void undo(Player player, LocalSession session, CommandContext context) throws WorldEditException { + if (session.hasFastMode()) { + BBC.COMMAND_UNDO_DISABLED.send(player); + return; + } int times = Math.max(1, context.getInteger(0, 1)); FawePlayer.wrap(player).checkConfirmation(() -> { EditSession undone = null;