mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
fix: Add blocked blocks to the correct set (#1975)
* fix: Add blocked blocks to the correct set * Address comment
This commit is contained in:
parent
8971d7064c
commit
2082df4141
@ -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]\"",
|
||||
|
@ -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;
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user