From 3f430645e4d7331d1875f8d04ac9c7cc0e693977 Mon Sep 17 00:00:00 2001 From: bloodshot Date: Sat, 30 Nov 2019 21:01:59 -0500 Subject: [PATCH] Fix investigation tool. * Fix NPE during entity move. --- .../griefdefender/listener/CommonEntityEventHandler.java | 4 +++- .../com/griefdefender/listener/PlayerEventHandler.java | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sponge/src/main/java/com/griefdefender/listener/CommonEntityEventHandler.java b/sponge/src/main/java/com/griefdefender/listener/CommonEntityEventHandler.java index fb61623..f663917 100644 --- a/sponge/src/main/java/com/griefdefender/listener/CommonEntityEventHandler.java +++ b/sponge/src/main/java/com/griefdefender/listener/CommonEntityEventHandler.java @@ -331,7 +331,9 @@ public boolean onEntityMove(MoveEntityEvent event, Location fromLocation, user.getInternalPlayerData().inTown = false; } - checkPlayerFlight(player, user.getInternalPlayerData(), fromClaim, toClaim); + if (player != null) { + checkPlayerFlight(player, user.getInternalPlayerData(), fromClaim, toClaim); + } } } diff --git a/sponge/src/main/java/com/griefdefender/listener/PlayerEventHandler.java b/sponge/src/main/java/com/griefdefender/listener/PlayerEventHandler.java index 2e49220..a4a5457 100644 --- a/sponge/src/main/java/com/griefdefender/listener/PlayerEventHandler.java +++ b/sponge/src/main/java/com/griefdefender/listener/PlayerEventHandler.java @@ -980,13 +980,12 @@ private void onPlayerHandleClaimCreateAction(InteractEvent event, BlockSnapshot return; } - /*if (!playerData.claimMode) { + if (!playerData.claimMode) { GriefDefenderConfig activeConfig = GriefDefenderPlugin.getActiveConfig(player.getWorld().getProperties()); - ItemType materialInHand = player.getItemInHand(handType).get().getType(); - if (!materialInHand.getId().equals(activeConfig.getConfig().claim.modificationTool)) { + if (!itemInHand.getType().getId().equals(activeConfig.getConfig().claim.modificationTool)) { return; } - }*/ + } GDTimings.PLAYER_HANDLE_SHOVEL_ACTION.startTimingIfSync(); BlockSnapshot clickedBlock = targetBlock;