mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
dealDamage() will now send fake EntityDamageEvent which mcMMO will ignore
This commit is contained in:
parent
89ab87b6dd
commit
fe7ca65f22
@ -27,6 +27,7 @@ import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.skills.Acrobatics;
|
||||
@ -296,7 +297,7 @@ public class Combat
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
|
||||
if(LoadProperties.eventCallback) {
|
||||
EntityDamageEvent ede = new EntityDamageEvent(target, cause, dmg);
|
||||
EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
if(ede.isCancelled()) return;
|
||||
|
||||
|
@ -47,6 +47,7 @@ import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.skills.Acrobatics;
|
||||
import com.gmail.nossr50.skills.Archery;
|
||||
@ -93,6 +94,9 @@ public class mcEntityListener implements Listener
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event)
|
||||
{
|
||||
if(event instanceof FakeEntityDamageEvent)
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
EntityType type = entity.getType();
|
||||
DamageCause cause = event.getCause();
|
||||
|
Loading…
Reference in New Issue
Block a user