2
0
Эх сурвалжийг харах

Ignore "fake player" npcs in EntityPickupItemEvent

nossr50 4 жил өмнө
parent
commit
8ee405fbfd

+ 1 - 0
Changelog.txt

@@ -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.

+ 6 - 4
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

@@ -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();