Browse Source

Entities that target endermite no longer give XP (credits to TheBentoBox for the tip)

nossr50 6 years ago
parent
commit
4c63eee6d5
2 changed files with 12 additions and 0 deletions
  1. 1 0
      Changelog.txt
  2. 11 0
      src/main/java/com/gmail/nossr50/listeners/EntityListener.java

+ 1 - 0
Changelog.txt

@@ -8,6 +8,7 @@ Key:
   - Removal
   - Removal
 
 
 Version 2.1.4
 Version 2.1.4
+    Removed XP from entities that target endermite to prevent easy exploitation (Credits to BentoBox for the tip!)
     Fixed a bug where static chance skills like Arcane Salvage were using incorrect calculations for success
     Fixed a bug where static chance skills like Arcane Salvage were using incorrect calculations for success
     Advanced Salvage now uses a rank system
     Advanced Salvage now uses a rank system
     Arcane Salvage now goes by your rank to determine the maximum amount of materials salvaged and is no longer percentage based
     Arcane Salvage now goes by your rank to determine the maximum amount of materials salvaged and is no longer percentage based

+ 11 - 0
src/main/java/com/gmail/nossr50/listeners/EntityListener.java

@@ -53,6 +53,17 @@ public class EntityListener implements Listener {
         this.plugin = plugin;
         this.plugin = plugin;
     }
     }
 
 
+    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+    public void onEntityTargetEntity(EntityTargetLivingEntityEvent event)
+    {
+        //Prevent entities from giving XP if they target endermite
+        if(event.getTarget() instanceof Endermite)
+        {
+            if(event.getTarget().getMetadata(mcMMO.entityMetadataKey) == null || event.getTarget().getMetadata(mcMMO.entityMetadataKey).size() <= 0)
+                event.getTarget().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
+        }
+    }
+
     @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
     @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
     public void onEntityShootBow(EntityShootBowEvent event) {
     public void onEntityShootBow(EntityShootBowEvent event) {
         /* WORLD BLACKLIST CHECK */
         /* WORLD BLACKLIST CHECK */