From 781bfc542fb02ac3c35bf4a80c6ef21802b2bb81 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Mon, 6 Dec 2021 08:31:46 -0500 Subject: [PATCH] fix: Properly delete ChangeSets on history clear (#1413) Fixes #1347 Co-authored-by: Jordan Co-authored-by: Alex --- .../main/java/com/sk89q/worldedit/LocalSession.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 55a899bab..f0a079e67 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -398,9 +398,20 @@ public class LocalSession implements TextureHolder { * Clear history. */ public void clearHistory() { - history.clear(); //FAWE start + historyWriteLock.lock(); + try { + // Ensure that changesets are properly removed + for (Object item : history) { + getChangeSet(item).delete(); + } + history.clear(); + } finally { + historyWriteLock.unlock(); + } + historyNegativeIndex = 0; + save(); historySize = 0; currentWorld = null; //FAWE end