فهرست منبع

Rupture fires a FakeEntityDamageByEntityEvent fixes #4122

nossr50 5 سال پیش
والد
کامیت
12abd68add
2فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 1 1
      Changelog.txt
  2. 6 0
      src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java

+ 1 - 1
Changelog.txt

@@ -2,12 +2,12 @@ Version 2.1.118
     Fixed another dupe bug
     Blast Mining no longer reduces debris from explosions due to some issues with the Bukkit API
     Modified locale string 'Mining.Blast.Effect' to remove debris reduction mention
+    Rupture now fires a FakeEntityDamageByEntityEvent before damaging its victims (cancelling it will be ignored)
 
 Version 2.1.117
     Fixed a rare http error when polling Mojang for UUIDs
     Fixed a bug that allowed duping
 
-
 Version 2.1.116
     Fixed directional plants not maintaining their direction when replanted
 

+ 6 - 0
src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java

@@ -2,6 +2,7 @@ package com.gmail.nossr50.runnables.skills;
 
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.datatypes.interactions.NotificationType;
+import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.util.MobHealthbarUtils;
 import com.gmail.nossr50.util.player.NotificationManager;
@@ -12,6 +13,7 @@ import com.gmail.nossr50.util.sounds.SoundType;
 import org.bukkit.Bukkit;
 import org.bukkit.entity.LivingEntity;
 import org.bukkit.entity.Player;
+import org.bukkit.event.entity.EntityDamageEvent;
 import org.bukkit.inventory.ItemStack;
 import org.bukkit.scheduler.BukkitRunnable;
 
@@ -115,6 +117,10 @@ public class BleedTimerTask extends BukkitRunnable {
 
 //            debugMessage+="TargetHealthBeforeDMG=["+String.valueOf(target.getHealth())+"], ";
 
+            //Fire a fake event
+            FakeEntityDamageByEntityEvent fakeEntityDamageByEntityEvent = (FakeEntityDamageByEntityEvent) CombatUtils.sendEntityDamageEvent(containerEntry.getValue().damageSource, target, EntityDamageEvent.DamageCause.CUSTOM, damage);
+            Bukkit.getPluginManager().callEvent(fakeEntityDamageByEntityEvent);
+
             CombatUtils.dealNoInvulnerabilityTickDamageRupture(target, damage, containerEntry.getValue().damageSource, toolTier);
 
             double victimHealthAftermath = target.getHealth();