Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netherOnlyGenerator #742

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<XMaterial> randomMaterialList = newMaterial == XMaterial.BASALT ? netherOreLevels.get(upgradeLevel) : normalOreLevels.get(upgradeLevel);
sh0inx marked this conversation as resolved.
Show resolved Hide resolved
if (randomMaterialList == null) return;

Optional<XMaterial> xMaterialOptional = randomMaterialList.nextElement();
if (!xMaterialOptional.isPresent()) return;

if((randomMaterialList == netherOreLevels.get(upgradeLevel)) && (IridiumSkyblock.getInstance().getConfiguration().netherOnlyGenerator) && (!(event.getNewState().getWorld().getEnvironment() == World.Environment.NETHER))) return;

sh0inx marked this conversation as resolved.
Show resolved Hide resolved
Material material = xMaterialOptional.get().parseMaterial();
if (material == Material.COBBLESTONE && newMaterial == XMaterial.STONE) material = Material.STONE;
if (material != null) event.getNewState().setType(material);
});
}

}
Loading