Add missing blocks and block tile entities from /plot set if the chunk processor is enabled

This commit is contained in:
Alexander Söderberg 2020-05-13 14:24:04 +02:00
parent 19fe2efb6e
commit ec347f8738
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678
2 changed files with 11 additions and 3 deletions

View File

@ -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);

View File

@ -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<String> forbiddenTypes = Settings.General.INVALID_BLOCKS;
final List<String> 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) {