Fixed NullPointerException when logging player death item drops (fixes #71)

This commit is contained in:
Intelli 2021-08-22 14:25:26 -06:00
parent da718de252
commit bc39bc03d6

View File

@ -20,6 +20,10 @@ import net.coreprotect.consumer.Queue;
public final class PlayerDropItemListener extends Queue implements Listener { public final class PlayerDropItemListener extends Queue implements Listener {
protected static void playerDropItem(Location location, Player player, ItemStack itemStack) { 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(); String loggingItemId = player.getName().toLowerCase(Locale.ROOT) + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ();
int itemId = getItemId(loggingItemId); int itemId = getItemId(loggingItemId);
@ -41,10 +45,6 @@ public final class PlayerDropItemListener extends Queue implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
ItemStack itemStack = item.getItemStack(); ItemStack itemStack = item.getItemStack();
if (itemStack == null) {
return;
}
playerDropItem(location, player, itemStack); playerDropItem(location, player, itemStack);
} }