diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index 9486d05c..834f266d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -20,6 +20,8 @@ package de.steamwar.bausystem.region; import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.extent.clipboard.Clipboard; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.flags.Flag; @@ -502,20 +504,15 @@ public class Region { public boolean undo() { initSessions(); - EditSession session = null; - try { - session = undoSessions.pop(); - if (session == null) { - return false; - } - session.undo(session); - redoSessions.push(session); - return true; - } finally { - if (session != null) { - session.flushSession(); - } + EditSession session = undoSessions.pop(); + if (session == null) + return false; + + try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) { + session.undo(e); + redoSessions.push(e); } + return true; } public boolean redo() {