From 168cbe1ebcce96b10b058a4a7d0a2c72a4086e53 Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 6 Feb 2019 17:42:06 -0800 Subject: [PATCH] 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 --- .../caveblock/generators/populators/MaterialPopulator.java | 6 ++++-- src/main/resources/config.yml | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java b/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java index c8bb8a5..5c3d0ff 100644 --- a/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java +++ b/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java @@ -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."); } }); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index dd5a831..14482ff 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -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