Allow placing certain blocks only if a dimension is unlocked

This commit is contained in:
Fabrizio La Rosa 2020-06-14 18:20:28 +02:00
parent 8f3bcd8ad7
commit 94e56d3b10
2 changed files with 60 additions and 1 deletions

View File

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

View File

@ -324,4 +324,41 @@ Island:
AllowNetherWater: false
WaterDisappearWithNetherMobs: false
WaterDoNotFlowNearNetherMobs: false
BlazeImmuneToWaterInNether: false
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