Selaa lähdekoodia

Prevent spam from breeding events

nossr50 6 vuotta sitten
vanhempi
sitoutus
1ae9e80d96

+ 8 - 1
src/main/java/com/gmail/nossr50/listeners/EntityListener.java

@@ -72,6 +72,8 @@ public class EntityListener implements Listener {
         if(!ExperienceConfig.getInstance().isEndermanEndermiteFarmingPrevented())
             return;
 
+        if(event.getReason() == EntityTargetEvent.TargetReason.TEMPT)
+
         //It's rare but targets can be null sometimes
         if(event.getTarget() == null)
         {
@@ -683,7 +685,7 @@ public class EntityListener implements Listener {
      * @param event
      *            The event to watch
      */
-    @EventHandler(priority = EventPriority.MONITOR)
+    @EventHandler(ignoreCancelled = true)
     public void onEntityDeath(EntityDeathEvent event) {
         /* WORLD BLACKLIST CHECK */
         if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
@@ -739,6 +741,11 @@ public class EntityListener implements Listener {
         if(ExperienceConfig.getInstance().isCOTWBreedingPrevented()) {
             if(event.getFather().hasMetadata(mcMMO.COTW_TEMPORARY_SUMMON) || event.getMother().hasMetadata(mcMMO.COTW_TEMPORARY_SUMMON)) {
                 event.setCancelled(true);
+                Animals mom = (Animals) event.getMother();
+                Animals father = (Animals) event.getFather();
+
+                mom.setLoveModeTicks(0);
+                father.setLoveModeTicks(0);
             }
 
             if(event.getBreeder() instanceof Player) {

+ 1 - 1
src/main/resources/locale/locale_en_US.properties

@@ -929,7 +929,7 @@ Guides.Swords.Section.2=[[DARK_AQUA]]How does Counter Attack work?\n[[YELLOW]]Co
 Guides.Swords.Section.3=[[DARK_AQUA]]How does Rupture work?\n[[YELLOW]]Rupture causes enemies to take damage every two seconds. The \n[[YELLOW]]target will bleed until the effect wears off, or death, \n[[YELLOW]]whichever comes first.\n[[YELLOW]]The duration of the bleed is increased by your sword skill.
 ##Taming
 Guides.Taming.Section.0=[[DARK_AQUA]]About Taming:\n[[YELLOW]]Taming will give players various combat bonuses when using\n[[YELLOW]]tamed wolves.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]To gain XP in this skill, you need to tame wolves/ocelots or\n[[YELLOW]]get into combat with your wolves.
-Guides.Taming.Section.1=[[DARK_AQUA]]How does Call of the Wild work?\n[[YELLOW]]Call of the Wild is an active ability that will allow you to summon\n[[YELLOW]]a wolf or an ocelot by your side. You can do this by\n[[YELLOW]]left-clicking while holding bones or fish.
+Guides.Taming.Section.1=[[DARK_AQUA]]How does Call of the Wild work?\n[[YELLOW]]Call of the Wild is an active ability that will allow you to summon\n[[YELLOW]]a wolf or an ocelot by your side. You can do this by\n[[YELLOW]]sneaking + left-clicking while holding bones or fish.
 Guides.Taming.Section.2=[[DARK_AQUA]]How does Beast Lore work?\n[[YELLOW]]Beast Lore allows players to inspect pets and to check the\n[[YELLOW]]stats of wolves and ocelots. Left-click a wolf or ocelot to use\n[[YELLOW]]Beast Lore.
 Guides.Taming.Section.3=[[DARK_AQUA]]How does Gore work?\n[[YELLOW]]Gore is a passive ability that has a chance of inflicting a\n[[YELLOW]]bleeding effect on your wolves' targets.
 Guides.Taming.Section.4=[[DARK_AQUA]]How does Sharpened Claws work?\n[[YELLOW]]Sharpened Claws provides a damage bonus to damage dealt\n[[YELLOW]]by wolves. The damage bonus depends on your Taming level.