Fix npe in getMaterial on older versions

This commit is contained in:
Fabrizio La Rosa 2020-07-14 10:24:24 +02:00 committed by Brianna
parent 64e54fccf1
commit a20ccf0c1e

View File

@ -1356,10 +1356,10 @@ public enum CompatibleMaterial {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { // Flattening
return CompatibleMaterial.getMaterialFromNewBlock(block);
} else { // Pre-Flattening
if(block != null){
if(block != null) {
if (block.getData() != 0) {
for (CompatibleMaterial cm : CompatibleMaterial.values()) {
if (cm.getMaterial().equals(block.getType())) {
if (cm.isValidItem() && !cm.usesCompatibility() && cm.getMaterial() != null && cm.getMaterial().equals(block.getType())) {
if (cm.getData() == block.getData()) {
return cm;
}