浏览代码

Villagers give XP now

nossr50 6 年之前
父节点
当前提交
af744fa088
共有 2 个文件被更改,包括 6 次插入5 次删除
  1. 1 0
      Changelog.txt
  2. 5 5
      src/main/java/com/gmail/nossr50/util/Misc.java

+ 1 - 0
Changelog.txt

@@ -9,6 +9,7 @@ Key:
 
 Version 2.1.36
     Updated German locale (Thanks OverCrave)
+    Fixed a bug preventing Villagers from giving combat XP
     The /mcnotify command will now squelch almost all chat messages or action bar notifications sent to the player from mcMMO
     mcMMO will now remind players on an hourly basis that they are are not receiving notifications from mcMMO if they have run the mcnotify command and toggled squelch mode
     Added a new setting to advanced.yml "Feedback.PlayerTips", when set to true this will allow mcMMO to send periodic helpful messages to players, currently this only affects mcnotify reminders.

+ 5 - 5
src/main/java/com/gmail/nossr50/util/Misc.java

@@ -8,10 +8,7 @@ import com.google.common.collect.ImmutableSet;
 import org.bukkit.Location;
 import org.bukkit.Material;
 import org.bukkit.block.BlockState;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Item;
-import org.bukkit.entity.NPC;
-import org.bukkit.entity.Player;
+import org.bukkit.entity.*;
 import org.bukkit.inventory.ItemStack;
 
 import java.util.Collection;
@@ -43,7 +40,10 @@ public final class Misc {
     private Misc() {};
 
     public static boolean isNPCEntity(Entity entity) {
-        return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
+        return (entity == null
+                || (entity.hasMetadata("NPC") && !(entity instanceof Villager))
+                || (entity instanceof NPC && !(entity instanceof Villager))
+                || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
     }
 
     /**