Flush undo/redo

Dieser Commit ist enthalten in:
Matthew Miller 2018-12-09 15:33:35 +10:00
Ursprung 6f3016c7f0
Commit 926f6a6ab8

Datei anzeigen

@ -93,7 +93,7 @@ public class LocalSession {
private transient Mask mask; private transient Mask mask;
private transient TimeZone timezone = TimeZone.getDefault(); private transient TimeZone timezone = TimeZone.getDefault();
private transient BlockVector3 cuiTemporaryBlock; private transient BlockVector3 cuiTemporaryBlock;
private transient EditSession.ReorderMode reorderMode = EditSession.ReorderMode.FAST; private transient EditSession.ReorderMode reorderMode = EditSession.ReorderMode.MULTI_STAGE;
// Saved properties // Saved properties
private String lastScript; private String lastScript;
@ -226,12 +226,13 @@ public class LocalSession {
--historyPointer; --historyPointer;
if (historyPointer >= 0) { if (historyPointer >= 0) {
EditSession editSession = history.get(historyPointer); EditSession editSession = history.get(historyPointer);
EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() try (EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory()
.getEditSession(editSession.getWorld(), -1, newBlockBag, player); .getEditSession(editSession.getWorld(), -1, newBlockBag, player)) {
newEditSession.enableStandardMode(); newEditSession.enableStandardMode();
newEditSession.setReorderMode(reorderMode); newEditSession.setReorderMode(reorderMode);
newEditSession.setFastMode(fastMode); newEditSession.setFastMode(fastMode);
editSession.undo(newEditSession); editSession.undo(newEditSession);
}
return editSession; return editSession;
} else { } else {
historyPointer = 0; historyPointer = 0;
@ -250,12 +251,13 @@ public class LocalSession {
checkNotNull(player); checkNotNull(player);
if (historyPointer < history.size()) { if (historyPointer < history.size()) {
EditSession editSession = history.get(historyPointer); EditSession editSession = history.get(historyPointer);
EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() try (EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory()
.getEditSession(editSession.getWorld(), -1, newBlockBag, player); .getEditSession(editSession.getWorld(), -1, newBlockBag, player)) {
newEditSession.enableStandardMode(); newEditSession.enableStandardMode();
newEditSession.setReorderMode(reorderMode); newEditSession.setReorderMode(reorderMode);
newEditSession.setFastMode(fastMode); newEditSession.setFastMode(fastMode);
editSession.redo(newEditSession); editSession.redo(newEditSession);
}
++historyPointer; ++historyPointer;
return editSession; return editSession;
} }