From 94e56d3b102afecafb878b72473322c86d043485 Mon Sep 17 00:00:00 2001 From: Fabrizio La Rosa Date: Sun, 14 Jun 2020 18:20:28 +0200 Subject: [PATCH] Allow placing certain blocks only if a dimension is unlocked --- .../com/songoda/skyblock/listeners/Block.java | 22 +++++++++++ src/main/resources/config.yml | 39 ++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/songoda/skyblock/listeners/Block.java b/src/main/java/com/songoda/skyblock/listeners/Block.java index cc83827b..1219a981 100644 --- a/src/main/java/com/songoda/skyblock/listeners/Block.java +++ b/src/main/java/com/songoda/skyblock/listeners/Block.java @@ -211,6 +211,28 @@ public class Block implements Listener { FileConfiguration configLoad = config.getFileConfiguration(); IslandWorld world = worldManager.getIslandWorld(block.getWorld()); + if(!player.hasPermission("fabledskyblock.bypass.netherplace") && !islandManager.isIslandWorldUnlocked(island, IslandWorld.Nether)){ + for(String s : Objects.requireNonNull(configLoad.getConfigurationSection("Island.Restrict.NetherBlocks")).getKeys(false)){ + if(s.equalsIgnoreCase(block.getType().toString())){ + if(configLoad.getBoolean("Island.Restrict.NetherBlocks." + s)){ + skyblock.getMessageManager().sendMessage(player, "&cDevi prima sbloccare il Nether per poter piazzare questo blocco!"); + event.setCancelled(true); + } + } + } + } + + if(!player.hasPermission("fabledskyblock.bypass.endplace") && !islandManager.isIslandWorldUnlocked(island, IslandWorld.End)){ + for(String s : Objects.requireNonNull(configLoad.getConfigurationSection("Island.Restrict.EndBlocks")).getKeys(false)){ + if(s.equalsIgnoreCase(block.getType().toString())){ + if(configLoad.getBoolean("Island.Restrict.EndBlocks." + s)){ + skyblock.getMessageManager().sendMessage(player, "&cDevi prima sbloccare l'End per poter piazzare questo blocco!"); + event.setCancelled(true); + } + } + } + } + if (configLoad.getBoolean("Island.WorldBorder.Block") && block.getType() == Material.DISPENSER) { if (!islandManager.isLocationAtIsland(island, blockLoc, world)) { event.setCancelled(true); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 74e15f86..c89840a9 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -324,4 +324,41 @@ Island: AllowNetherWater: false WaterDisappearWithNetherMobs: false WaterDoNotFlowNearNetherMobs: false - BlazeImmuneToWaterInNether: false \ No newline at end of file + BlazeImmuneToWaterInNether: false + Restrict: + NetherBlocks: + NETHERRACK: true + SOUL_SAND: true + GLOWSTONE: true + NETHER_BRICKS: true + NETHER_BRICK_STAIRS: true + NETHER_BRICK_SLAB: true + NETHER_QUARTZ_ORE: true + QUARTZ_BLOCK: true + QUARTZ_PILLAR: true + CHISELED_QUARTZ_BLOCK: true + QUARTZ_STAIRS: true + NETHER_BRICK_WALL: true + NETHER_BRICK_FENCE: true + RED_NETHER_BRICKS: true + RED_NETHER_BRICK_STAIRS: true + RED_NETHER_BRICK_SLAB: true + RED_NETHER_BRICK_WALL: true + NETHER_WART: true + NETHER_WART_BLOCK: true + WITHER_SKELETON_SKULL: true + WITHER_ROSE: true + EndBlocks: + END_STONE: true + END_STONE_BRICKS: true + END_STONE_BRICK_WALL: true + END_STONE_BRICK_STAIRS: true + END_STONE_BRICK_SLAB: true + PURPUR_BLOCK: true + PURPUR_SLAB: true + PURPUR_PILLAR: true + PURPUR_STAIRS: true + END_ROD: true + END_CRYSTAL: true + CHORUS_FLOWER: true + CHORUS_PLANT: true \ No newline at end of file