Fixed npe in BiomeIcon

This commit is contained in:
Fabrizio La Rosa 2020-07-06 08:37:25 +02:00
parent 4448dd2a6f
commit 619781eff9

View File

@ -32,7 +32,11 @@ public class BiomeIcon {
}
byte tempData = (byte) biomeConfig.getInt("Biomes." + biome.name() + ".DisplayItem.Data", 0);
this.displayItem = CompatibleMaterial.getMaterial(tempMat.getMaterial(), tempData).getItem();
CompatibleMaterial displayMaterial = CompatibleMaterial.getMaterial(tempMat.getMaterial(), tempData);
if(displayMaterial == null) {
displayMaterial = CompatibleMaterial.STONE;
}
this.displayItem = displayMaterial.getItem();
ItemMeta im = displayItem.getItemMeta();
if(im != null){
im.setDisplayName(ChatColor.translateAlternateColorCodes('&', biomeConfig.getString("Biomes." + biome.name() + ".DisplayName", biome.name())));