Ignore "fake player" npcs in EntityPickupItemEvent

This commit is contained in:
nossr50 2020-12-31 15:49:32 -08:00
parent 2664ae4bd6
commit 8ee405fbfd
2 changed files with 7 additions and 4 deletions

View File

@ -7,6 +7,7 @@ Version 2.1.165
mcMMO will now be compatible with changes to world height (1.17 compatibility)
Added missing cooldown locale message 'Commands.Database.Cooldown'
Added new locale message 'Taming.Summon.COTW.Removed'
mcMMO will ignore PlayerPickupItem events from "Fake-Player" NPCs if it recognizes them as such, this will prevent some issues
NOTES:
Books dropped before this fix will not be usable and should just be chucked in lava, the broken books have blue names, the working books have yellow names.

View File

@ -447,6 +447,10 @@ public class PlayerListener implements Listener {
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
if(Misc.isNPCEntityExcludingVillagers(event.getEntity())) {
return;
}
if(event.getEntity() instanceof Player)
{
Player player = (Player) event.getEntity();
@ -463,13 +467,11 @@ public class PlayerListener implements Listener {
}
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer == null) {
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Item drop = event.getItem();
ItemStack dropStack = drop.getItemStack();