From bc39bc03d655bbca03102a1c5dc3863faec1842a Mon Sep 17 00:00:00 2001 From: Intelli Date: Sun, 22 Aug 2021 14:25:26 -0600 Subject: [PATCH] Fixed NullPointerException when logging player death item drops (fixes #71) --- .../listener/player/PlayerDropItemListener.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/coreprotect/listener/player/PlayerDropItemListener.java b/src/main/java/net/coreprotect/listener/player/PlayerDropItemListener.java index c004c71..9618caa 100644 --- a/src/main/java/net/coreprotect/listener/player/PlayerDropItemListener.java +++ b/src/main/java/net/coreprotect/listener/player/PlayerDropItemListener.java @@ -20,6 +20,10 @@ import net.coreprotect.consumer.Queue; public final class PlayerDropItemListener extends Queue implements Listener { protected static void playerDropItem(Location location, Player player, ItemStack itemStack) { + if (itemStack == null) { + return; + } + String loggingItemId = player.getName().toLowerCase(Locale.ROOT) + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ(); int itemId = getItemId(loggingItemId); @@ -41,10 +45,6 @@ public final class PlayerDropItemListener extends Queue implements Listener { Player player = event.getPlayer(); ItemStack itemStack = item.getItemStack(); - if (itemStack == null) { - return; - } - playerDropItem(location, player, itemStack); }