This commit is contained in:
2021-01-03 01:21:15 -06:00
parent 8ecc1d2fce
commit 5bafa1122c
91 changed files with 452 additions and 460 deletions

View File

@ -0,0 +1,32 @@
package dev.plex.world;
import dev.plex.Plex;
import java.util.LinkedHashMap;
import org.bukkit.Material;
import org.bukkit.generator.BlockPopulator;
public class ConfigurationChunkGenerator extends BlockMapChunkGenerator
{
private static final Plex plugin = Plex.get();
public ConfigurationChunkGenerator(String worldName, BlockPopulator... populators)
{
super(createBlockMap(worldName), populators);
}
private static LinkedHashMap<Material, Integer> createBlockMap(String worldName)
{
LinkedHashMap<Material, Integer> blockMap = new LinkedHashMap<>();
for (String key : plugin.config.getConfigurationSection("worlds." + worldName + ".parameters").getKeys(false))
{
Material material = Material.getMaterial(key.toUpperCase());
if (material == null)
{
continue;
}
int count = plugin.config.getInt("worlds." + worldName + ".parameters." + key);
blockMap.put(material, count);
}
return blockMap;
}
}