mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
Fixed the replaceBlocks that takes a Pattern too. Closes #1083.
This commit is contained in:
parent
ea4ee34810
commit
1f921779fa
@ -1333,7 +1333,7 @@ public class EditSession {
|
|||||||
public int replaceBlocks(Region region, Set<BaseBlock> fromBlockTypes, Pattern pattern) throws MaxChangedBlocksException {
|
public int replaceBlocks(Region region, Set<BaseBlock> fromBlockTypes, Pattern pattern) throws MaxChangedBlocksException {
|
||||||
Set<BaseBlock> definiteBlockTypes = new HashSet<BaseBlock>();
|
Set<BaseBlock> definiteBlockTypes = new HashSet<BaseBlock>();
|
||||||
Set<Integer> fuzzyBlockTypes = new HashSet<Integer>();
|
Set<Integer> fuzzyBlockTypes = new HashSet<Integer>();
|
||||||
|
if (fromBlockTypes != null) {
|
||||||
for (BaseBlock block : fromBlockTypes) {
|
for (BaseBlock block : fromBlockTypes) {
|
||||||
if (block.getData() == -1) {
|
if (block.getData() == -1) {
|
||||||
fuzzyBlockTypes.add(block.getType());
|
fuzzyBlockTypes.add(block.getType());
|
||||||
@ -1341,6 +1341,7 @@ public class EditSession {
|
|||||||
definiteBlockTypes.add(block);
|
definiteBlockTypes.add(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
@ -1362,14 +1363,14 @@ public class EditSession {
|
|||||||
Vector pt = new Vector(x, y, z);
|
Vector pt = new Vector(x, y, z);
|
||||||
BaseBlock curBlockType = getBlock(pt);
|
BaseBlock curBlockType = getBlock(pt);
|
||||||
|
|
||||||
if (definiteBlockTypes == null) {
|
if (fromBlockTypes == null) {
|
||||||
//replace <to-block>
|
//replace <to-block>
|
||||||
if (curBlockType.isAir()) {
|
if (curBlockType.isAir()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//replace <from-block> <to-block>
|
//replace <from-block> <to-block>
|
||||||
if (!definiteBlockTypes.contains(curBlockType) && fuzzyBlockTypes.contains(curBlockType.getType())) {
|
if (!definiteBlockTypes.contains(curBlockType) && !fuzzyBlockTypes.contains(curBlockType.getType())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1384,14 +1385,14 @@ public class EditSession {
|
|||||||
for (Vector pt : region) {
|
for (Vector pt : region) {
|
||||||
BaseBlock curBlockType = getBlock(pt);
|
BaseBlock curBlockType = getBlock(pt);
|
||||||
|
|
||||||
if (definiteBlockTypes == null) {
|
if (fromBlockTypes == null) {
|
||||||
//replace <to-block>
|
//replace <to-block>
|
||||||
if (curBlockType.isAir()) {
|
if (curBlockType.isAir()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//replace <from-block> <to-block>
|
//replace <from-block> <to-block>
|
||||||
if (!definiteBlockTypes.contains(curBlockType) && fuzzyBlockTypes.contains(curBlockType.getType())) {
|
if (!definiteBlockTypes.contains(curBlockType) && !fuzzyBlockTypes.contains(curBlockType.getType())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user