Undo/redo should not be allowed outside allowed regions by default.

Fixes #949
This commit is contained in:
dordsor21
2021-07-10 14:14:34 +01:00
parent 0434b86d8e
commit 338be0ff31
3 changed files with 22 additions and 9 deletions

View File

@ -566,15 +566,17 @@ public class LocalSession implements TextureHolder {
loadSessionHistoryFromDisk(actor.getUniqueId(), world);
if (getHistoryNegativeIndex() < history.size()) {
ChangeSet changeSet = getChangeSet(history.get(getHistoryIndex()));
try (EditSession newEditSession = new EditSessionBuilder(world)
.allowedRegionsEverywhere()
.checkMemory(false)
.changeSetNull()
.fastmode(false)
.limitUnprocessed((Player)actor)
.player((Player)actor)
.blockBag(getBlockBag((Player)actor))
.build()) {
EditSessionBuilder builder = new EditSessionBuilder(world)
.checkMemory(false)
.changeSetNull()
.fastmode(false)
.limitUnprocessed((Player)actor)
.player((Player)actor)
.blockBag(getBlockBag((Player)actor));
if (!actor.getLimit().RESTRICT_HISTORY_TO_REGIONS) {
builder.allowedRegionsEverywhere();
}
try (EditSession newEditSession = builder.build()) {
newEditSession.setBlocks(changeSet, ChangeSetExecutor.Type.UNDO);
setDirty();
historyNegativeIndex++;