geforkt von Mirrors/FastAsyncWorldEdit
Undo/redo should not be allowed outside allowed regions by default.
Fixes #949
Dieser Commit ist enthalten in:
Ursprung
0434b86d8e
Commit
338be0ff31
@ -167,6 +167,11 @@ public class Settings extends Config {
|
||||
"Should large edits require confirmation (>16384 chunks)",
|
||||
})
|
||||
public boolean CONFIRM_LARGE = true;
|
||||
@Comment({
|
||||
"If undo and redo commands should be restricted to allowed regions",
|
||||
" - Prevents scenarios where players can delete/reset a region, and then continue to undo/redo on it"
|
||||
})
|
||||
public boolean RESTRICT_HISTORY_TO_REGIONS = true;
|
||||
@Comment({
|
||||
"List of blocks to strip nbt from",
|
||||
})
|
||||
@ -523,6 +528,7 @@ public class Settings extends Config {
|
||||
limit.SPEED_REDUCTION = Math.min(limit.SPEED_REDUCTION, newLimit.SPEED_REDUCTION);
|
||||
limit.FAST_PLACEMENT |= newLimit.FAST_PLACEMENT;
|
||||
limit.CONFIRM_LARGE &= newLimit.CONFIRM_LARGE;
|
||||
limit.RESTRICT_HISTORY_TO_REGIONS &= newLimit.RESTRICT_HISTORY_TO_REGIONS;
|
||||
if (limit.STRIP_NBT == null) {
|
||||
limit.STRIP_NBT = newLimit.STRIP_NBT.isEmpty() ? Collections.emptySet() : new HashSet<>(newLimit.STRIP_NBT);
|
||||
} else if (limit.STRIP_NBT.isEmpty() || newLimit.STRIP_NBT.isEmpty()) {
|
||||
|
@ -18,6 +18,7 @@ public class FaweLimit {
|
||||
public int SPEED_REDUCTION = Integer.MAX_VALUE;
|
||||
public boolean FAST_PLACEMENT = false;
|
||||
public boolean CONFIRM_LARGE = true;
|
||||
public boolean RESTRICT_HISTORY_TO_REGIONS = true;
|
||||
public Set<String> STRIP_NBT = null;
|
||||
|
||||
public static FaweLimit MAX;
|
||||
@ -108,6 +109,7 @@ public class FaweLimit {
|
||||
MAX.MAX_EXPRESSION_MS = 50;
|
||||
MAX.FAST_PLACEMENT = true;
|
||||
MAX.CONFIRM_LARGE = true;
|
||||
MAX.RESTRICT_HISTORY_TO_REGIONS = false;
|
||||
MAX.STRIP_NBT = null;
|
||||
}
|
||||
|
||||
@ -229,6 +231,7 @@ public class FaweLimit {
|
||||
&& INVENTORY_MODE == 0
|
||||
&& SPEED_REDUCTION == 0
|
||||
&& FAST_PLACEMENT
|
||||
&& !RESTRICT_HISTORY_TO_REGIONS
|
||||
&& (STRIP_NBT == null || STRIP_NBT.isEmpty());
|
||||
}
|
||||
|
||||
@ -245,6 +248,7 @@ public class FaweLimit {
|
||||
SPEED_REDUCTION = limit.SPEED_REDUCTION;
|
||||
FAST_PLACEMENT = limit.FAST_PLACEMENT;
|
||||
CONFIRM_LARGE = limit.CONFIRM_LARGE;
|
||||
RESTRICT_HISTORY_TO_REGIONS = limit.RESTRICT_HISTORY_TO_REGIONS;
|
||||
STRIP_NBT = limit.STRIP_NBT;
|
||||
}
|
||||
|
||||
@ -262,6 +266,7 @@ public class FaweLimit {
|
||||
limit.MAX_HISTORY = MAX_HISTORY;
|
||||
limit.FAST_PLACEMENT = FAST_PLACEMENT;
|
||||
limit.CONFIRM_LARGE = CONFIRM_LARGE;
|
||||
limit.RESTRICT_HISTORY_TO_REGIONS = RESTRICT_HISTORY_TO_REGIONS;
|
||||
limit.STRIP_NBT = STRIP_NBT;
|
||||
return limit;
|
||||
}
|
||||
|
@ -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++;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren