From 8710f2f83be0cbd5954d14f3966b1604ae76ef6c Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 13 Feb 2019 13:43:22 +0000 Subject: [PATCH] Fix NPE when right-clicking a >1.13 block --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 890d82f85..93d462d32 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -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; }