Fix NPE when right-clicking a >1.13 block

This commit is contained in:
dordsor21 2019-02-13 13:43:22 +00:00
parent 3e8308ecd7
commit 8710f2f83b

View File

@ -1876,10 +1876,14 @@ import java.util.regex.Pattern;
eventType = PlayerBlockEventType.TELEPORT_OBJECT;
break;
default:
int blockId = ((LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings()
.fromStringToLegacy(blockType.name())).id;
if (blockId > 197) {
eventType = PlayerBlockEventType.INTERACT_BLOCK;
LegacyPlotBlock legacyPlotBlock =
(LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings()
.fromStringToLegacy(blockType.name());
if (legacyPlotBlock != null) {
int blockId = legacyPlotBlock.id;
if (blockId > 197) {
eventType = PlayerBlockEventType.INTERACT_BLOCK;
}
}
break;
}