diff --git a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java index 8a692bddf..98194f612 100644 --- a/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java +++ b/src/main/java/com/iridium/iridiumskyblock/configs/Configuration.java @@ -48,6 +48,7 @@ public Configuration() { public boolean obsidianBucket = true; + public boolean netherOnlyGenerator = false; public boolean endPortalPick = true; public boolean removeIslandBlocksOnDelete = false; public boolean clearInventoryOnRegen = false; diff --git a/src/main/java/com/iridium/iridiumskyblock/listeners/BlockFormListener.java b/src/main/java/com/iridium/iridiumskyblock/listeners/BlockFormListener.java index 15cbeb236..a337077c3 100644 --- a/src/main/java/com/iridium/iridiumskyblock/listeners/BlockFormListener.java +++ b/src/main/java/com/iridium/iridiumskyblock/listeners/BlockFormListener.java @@ -5,6 +5,7 @@ import com.iridium.iridiumskyblock.RandomAccessList; import com.iridium.iridiumskyblock.enhancements.GeneratorEnhancementData; import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockFormEvent; @@ -31,16 +32,18 @@ public void onBlockForm(BlockFormEvent event) { if (!generatorMaterials.contains(newMaterial)) return; IridiumSkyblock.getInstance().getIslandManager().getTeamViaLocation(event.getNewState().getLocation()).ifPresent(island -> { int upgradeLevel = IridiumSkyblock.getInstance().getIslandManager().getTeamEnhancement(island, "generator").getLevel(); - RandomAccessList randomMaterialList = newMaterial == XMaterial.BASALT ? netherOreLevels.get(upgradeLevel) : normalOreLevels.get(upgradeLevel); + boolean isBasaltGenerator = newMaterial == XMaterial.BASALT; + RandomAccessList randomMaterialList = isBasaltGenerator ? netherOreLevels.get(upgradeLevel) : normalOreLevels.get(upgradeLevel); if (randomMaterialList == null) return; Optional xMaterialOptional = randomMaterialList.nextElement(); if (!xMaterialOptional.isPresent()) return; + if( isBasaltGenerator && IridiumSkyblock.getInstance().getConfiguration().netherOnlyGenerator && event.getNewState().getWorld().getEnvironment() != World.Environment.NETHER) return; + Material material = xMaterialOptional.get().parseMaterial(); if (material == Material.COBBLESTONE && newMaterial == XMaterial.STONE) material = Material.STONE; if (material != null) event.getNewState().setType(material); }); } - } \ No newline at end of file