Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-10 05:20:04 +01:00
Correctly check for null values in EditSession.replaceBlocks()
Dieser Commit ist enthalten in:
Ursprung
2f2d3f8045
Commit
4bb5b56da8
@ -1248,6 +1248,7 @@ public class EditSession {
|
|||||||
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());
|
||||||
@ -1255,6 +1256,7 @@ public class EditSession {
|
|||||||
definiteBlockTypes.add(block);
|
definiteBlockTypes.add(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
@ -1275,10 +1277,18 @@ public class EditSession {
|
|||||||
for (int z = minZ; z <= maxZ; ++z) {
|
for (int z = minZ; z <= maxZ; ++z) {
|
||||||
Vector pt = new Vector(x, y, z);
|
Vector pt = new Vector(x, y, z);
|
||||||
BaseBlock curBlockType = getBlock(pt);
|
BaseBlock curBlockType = getBlock(pt);
|
||||||
|
|
||||||
|
if (fromBlockTypes == null) {
|
||||||
|
//replace <to-block>
|
||||||
|
if (curBlockType.isAir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} 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;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (setBlock(pt, toBlock)) {
|
if (setBlock(pt, toBlock)) {
|
||||||
++affected;
|
++affected;
|
||||||
@ -1290,10 +1300,17 @@ public class EditSession {
|
|||||||
for (Vector pt : region) {
|
for (Vector pt : region) {
|
||||||
BaseBlock curBlockType = getBlock(pt);
|
BaseBlock curBlockType = getBlock(pt);
|
||||||
|
|
||||||
|
if (fromBlockTypes == null) {
|
||||||
|
//replace <to-block>
|
||||||
|
if (curBlockType.isAir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} 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;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (setBlock(pt, toBlock)) {
|
if (setBlock(pt, toBlock)) {
|
||||||
++affected;
|
++affected;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren