3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00

fix: Add blocked blocks to the correct set (#1975)

* fix: Add blocked blocks to the correct set

* Address comment
Dieser Commit ist enthalten in:
Jordan 2022-10-13 18:21:25 +01:00 committet von GitHub
Ursprung 8971d7064c
Commit 2082df4141
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 9 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -391,8 +391,8 @@ public class Settings extends Config {
public boolean UNIVERSAL_DISALLOWED_BLOCKS = true;
@Comment({
"List of blocks to deny use of. Can be either an entire block type or a block with a specific property value.",
"Where block properties are specified, any blockstate with the property will be disallowed (i.g. all directions",
"of a waterlogged fence). For blocking/remapping of all occurence of a property like waterlogged, see",
"Where block properties are specified, any blockstate with the property will be disallowed (e.g. all directions",
"of a waterlogged fence). For blocking/remapping of all occurrences of a property like waterlogged, see",
"remap-properties below.",
"Example block property blocking:",
" - \"minecraft:conduit[waterlogged=true]\"",

Datei anzeigen

@ -18,6 +18,7 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import com.sk89q.worldedit.world.block.FuzzyBlockState;
import javax.annotation.Nullable;
@ -26,12 +27,8 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import static com.sk89q.worldedit.world.block.BlockTypesCache.states;
public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IBatchProcessor {
private static final BlockState RESERVED = BlockTypes.__RESERVED__.getDefaultState();
@ -56,7 +53,7 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB
this.blockedBlocks = new HashSet<>();
for (String block : blockedBlocks) {
if (block.indexOf('[') == -1 || block.indexOf(']') == -1) {
blockedBlocks.add(block);
this.blockedBlocks.add(block);
continue;
}
String[] properties = block.substring(block.indexOf('[') + 1, block.indexOf(']')).split(",");
@ -138,7 +135,10 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB
it:
for (int i = 0; i < blocks.length; i++) {
char block = blocks[i];
BlockState state = states[block];
if (block == BlockTypesCache.ReservedIDs.__RESERVED__) {
continue;
}
BlockState state = BlockTypesCache.states[block];
if (blockedBlocks != null) {
if (blockedBlocks.contains(state.getBlockType().getId())) {
blocks[i] = 0;

Datei anzeigen

@ -605,7 +605,7 @@ public final class EditSessionBuilder {
}
if (this.limit != null && !this.limit.isUnlimited()) {
Set<String> limitBlocks = new HashSet<>();
if ((getActor() == null || getActor().hasPermission("worldedit.anyblock") && this.limit.UNIVERSAL_DISALLOWED_BLOCKS)) {
if ((getActor() == null || getActor().hasPermission("worldedit.anyblock")) && this.limit.UNIVERSAL_DISALLOWED_BLOCKS) {
limitBlocks.addAll(WorldEdit.getInstance().getConfiguration().disallowedBlocks);
}
if (this.limit.DISALLOWED_BLOCKS != null && !this.limit.DISALLOWED_BLOCKS.isEmpty()) {