mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-07 01:43:04 +00:00
tttt
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user