From ec347f8738323561bf685b8c98341e13d08905ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Wed, 13 May 2020 14:24:04 +0200 Subject: [PATCH] Add missing blocks and block tile entities from `/plot set` if the chunk processor is enabled --- .../java/com/plotsquared/bukkit/util/BukkitUtil.java | 4 ++-- .../main/java/com/plotsquared/core/command/Set.java | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index b1ec78382..96e8ddad1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -653,7 +653,7 @@ public class BukkitUtil extends WorldUtil { tileEntityTypes.addAll(BlockCategories.FLOWER_POTS.getAll()); // Individual Types // Add these from strings - Stream.of("barrel", "beacon", "beehive", "bell", "blast_furnace", + Stream.of("barrel", "beacon", "beehive", "bee_nest", "bell", "blast_furnace", "brewing_stand", "campfire", "chest", "ender_chest", "trapped_chest", "command_block", "end_gateway", "hopper", "jigsaw", "jubekox", "lectern", "note_block", "black_shulker_box", "blue_shulker_box", @@ -661,7 +661,7 @@ public class BukkitUtil extends WorldUtil { "light_blue_shulker_box", "light_gray_shulker_box", "lime_shulker_box", "magenta_shulker_box", "orange_shulker_box", "pink_shulker_box", "purple_shulker_box", "red_shulker_box", "shulker_box", "white_shulker_box", - "yellow_shulker_box", "smoker", "structure") + "yellow_shulker_box", "smoker", "structure_block", "structure_void") .map(BlockTypes::get) .filter(Objects::nonNull) .forEach(tileEntityTypes::add); diff --git a/Core/src/main/java/com/plotsquared/core/command/Set.java b/Core/src/main/java/com/plotsquared/core/command/Set.java index 54befdec9..3530cc5e4 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Set.java +++ b/Core/src/main/java/com/plotsquared/core/command/Set.java @@ -37,8 +37,10 @@ import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.PatternUtil; import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; +import com.plotsquared.core.util.WorldUtil; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockCategory; +import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import java.util.ArrayList; @@ -80,7 +82,13 @@ public class Set extends SubCommand { String material = StringMan.join(Arrays.copyOfRange(args, 1, args.length), ",").trim(); - final List forbiddenTypes = Settings.General.INVALID_BLOCKS; + final List forbiddenTypes = new ArrayList<>(Settings.General.INVALID_BLOCKS); + + if (Settings.Enabled_Components.CHUNK_PROCESSOR) { + forbiddenTypes.addAll(WorldUtil.IMP.getTileEntityTypes().stream().map( + BlockType::getName).collect(Collectors.toList())); + } + if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_ALLOW_UNSAFE) && !forbiddenTypes.isEmpty()) { for (String forbiddenType : forbiddenTypes) {