Adds error checking for MATERIALs in config.yml

MATERIALs must be blocks otherwise the world populator will throw errors
and crash the server. This commit checks that all imported materials are
blocks and if they are not logs the error.

Updated config.yml to use correct 1.13 material names for blocks.

https://github.com/BentoBoxWorld/CaveBlock/issues/11
This commit is contained in:
tastybento 2019-02-06 17:42:06 -08:00
parent ae26dfaa74
commit 168cbe1ebc
2 changed files with 7 additions and 5 deletions

View File

@ -146,11 +146,13 @@ public class MaterialPopulator extends BlockPopulator
filter(splitString -> splitString.length == 4).
forEach(splitString -> {
Material material = Material.getMaterial(splitString[1]);
if (material != null)
// Material must be a block otherwise the chunk cannot be populated
if (material != null && material.isBlock())
{
materialMap.put(material,
new Pair<>(Double.parseDouble(splitString[2]), Integer.parseInt(splitString[3])));
} else {
addon.logError("Could not parse MATERIAL in config.yml: " + splitString[1] + " is not a valid block.");
}
});

View File

@ -133,11 +133,11 @@ world:
# MATERIAL:DIAMOND_ORE:100:5 - means there is 100% chace of spawing diamonds
# where max amount in pack are 5 per each subchunk!
blocks:
- MATERIAL:QUARTZ_ORE:30:5
- MATERIAL:NETHER_QUARTZ_ORE:30:5
- MATERIAL:SOUL_SAND:40:10
- MATERIAL:MAGMA_BLOCK:10:3
- MATERIAL:GLOWSTONE:20:8
- MATERIAL:NETHER_BRICK:10:5
- MATERIAL:NETHER_BRICKS:10:5
- MATERIAL:LAVA:10:1
- ENTITY:MAGMA_CUBE:0.5:1
- ENTITY:GHAST:0.1:1
@ -166,7 +166,7 @@ world:
blocks:
- ENTITY:SHULKER:0.2:1
- MATERIAL:OBSIDIAN:1:1
- MATERIAL:CHORUS_FRUIT:1:3
- MATERIAL:CHORUS_PLANT:1:3
# Mob white list - these mobs will NOT be removed when logging in or doing /cave
remove-mobs-whitelist:
- WITHER