Adding to plugin base.

Untested.
This commit is contained in:
Harrison Deng 2020-04-19 20:31:59 -05:00
parent 943feece04
commit 37aa598d8f

View File

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