diff --git a/Changelog.txt b/Changelog.txt
index c541a9675..0f04fd96c 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,3 +1,6 @@
+Version 2.1.95
+ Fixed a bug preventing Wandering Traders from granting XP
+
Version 2.1.94
2 new devs have joined the mcMMO team (electronicboy, kashike), bringing the active dev team to 3 including myself! Strings relating to authors of mcMMO have been updated to reflect this
Fixed a bug where 2 people using Tree Feller could result in the tree being rejected for being too big
diff --git a/pom.xml b/pom.xml
index a82326bc2..b19bd57e9 100755
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.gmail.nossr50.mcMMO
mcMMO
- 2.1.94
+ 2.1.95-SNAPSHOT
mcMMO
https://github.com/mcMMO-Dev/mcMMO
diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java
index ff892d659..1a17e2727 100644
--- a/src/main/java/com/gmail/nossr50/util/Misc.java
+++ b/src/main/java/com/gmail/nossr50/util/Misc.java
@@ -40,17 +40,40 @@ public final class Misc {
private Misc() {};
+ /**
+ * Determines if an entity is an NPC but not a villager
+ * This method aims to establish compatibility between mcMMO and other plugins which create "NPCs"
+ *
+ * It does this by checking the following
+ * 1) The entity is not a Villager
+ * 2) The entity can be considered an NPC
+ *
+ * In this context, an NPC is a bit hard to define. Various plugins determine what an NPC is in different ways.
+ * @see Misc::isNPCIncludingVillagers
+ * @param entity target entity
+ * @return true if the entity is not a Villager and is not a "NPC"
+ */
public static boolean isNPCEntityExcludingVillagers(Entity entity) {
- return (entity == null
- || (entity.hasMetadata("NPC") && !(entity instanceof Villager))
- || (entity instanceof NPC && !(entity instanceof Villager))
- || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
+ return (!isVillager(entity)
+ && isNPCIncludingVillagers(entity)); //Compatibility with some mod..
}
- public static boolean isNPCIncludingVillagers(Player entity) {
+ public static boolean isNPCClassType(Entity entity) {
+ return entity instanceof NPC;
+ }
+
+ public static boolean hasNPCMetadataTag(Entity entity) {
+ return entity.hasMetadata("NPC");
+ }
+
+ public static boolean isVillager(Entity entity) {
+ return (entity instanceof AbstractVillager);
+ }
+
+ public static boolean isNPCIncludingVillagers(Entity entity) {
return (entity == null
- || (entity.hasMetadata("NPC"))
- || (entity instanceof NPC)
+ || (hasNPCMetadataTag(entity))
+ || (isNPCClassType(entity))
|| entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
}