From 37aa598d8f6f1f5fc8acbcab6a527770fea4439e Mon Sep 17 00:00:00 2001 From: Harrison Date: Sun, 19 Apr 2020 20:31:59 -0500 Subject: [PATCH] Adding to plugin base. Untested. --- .../IslandSurvivalCraft.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/IslandSurvivalCraft.java b/src/main/java/ca/recrown/islandsurvivalcraft/IslandSurvivalCraft.java index 7962075..a9f72ce 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/IslandSurvivalCraft.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/IslandSurvivalCraft.java @@ -1,35 +1,31 @@ package ca.recrown.islandsurvivalcraft; -import java.util.Random; - +import org.apache.commons.lang.NotImplementedException; import org.bukkit.World; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.java.JavaPlugin; -import ca.recrown.islandsurvivalcraft.worldgen.IslandBaseTerrainGenerator; -import nl.rutgerkok.worldgeneratorapi.WorldGeneratorApi; -import nl.rutgerkok.worldgeneratorapi.WorldRef; +import ca.recrown.islandsurvivalcraft.worldgen.IslandSurvivalCraftWorldGenerator; public class IslandSurvivalCraft extends JavaPlugin { + IslandSurvivalCraftWorldGenerator generator; @Override public void onEnable() { - // TODO Auto-generated method stub super.onEnable(); } @Override public void onDisable() { - // TODO Auto-generated method stub super.onDisable(); } @Override public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { - WorldGeneratorApi worldGenAPI = WorldGeneratorApi.getInstance(this, 0, 1); - return worldGenAPI.createCustomGenerator(WorldRef.ofName(worldName), gen -> { + if (generator == null) { World world = getServer().getWorld(worldName); - gen.setBaseTerrainGenerator(new IslandBaseTerrainGenerator(world)); - }); + generator = new IslandSurvivalCraftWorldGenerator(world.getSeed(), world.getMaxHeight(), world.getSeaLevel(), true); + } + return generator; } }