From 4dbd8d65d30148fa9ea99171070488ba526c8a58 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Fri, 29 Sep 2023 14:21:01 -0400 Subject: [PATCH] netherOnlyGenerator added `netherOnlyGenerator` config option and a check to `BlockFormListener` to determine whether to activate the basalt generator in the overworld & end or be nether exclusive --- .../com/iridium/iridiumskyblock/configs/Configuration.java | 1 + .../iridium/iridiumskyblock/listeners/BlockFormListener.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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..703771221 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); if (randomMaterialList == null) return; Optional xMaterialOptional = randomMaterialList.nextElement(); if (!xMaterialOptional.isPresent()) return; + if((randomMaterialList == netherOreLevels.get(upgradeLevel)) && (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