[Bleeding] Added event calls for healing and harming by potions

By: Zeerix <zeerix@draig.de>
This commit is contained in:
CraftBukkit/Spigot 2012-01-14 00:29:44 +01:00
parent b785b7f01c
commit 0c70cec69d

View File

@ -4,6 +4,7 @@ import java.net.InetAddress;
import java.util.List;
import net.minecraft.server.ChunkCoordinates;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityBlaze;
import net.minecraft.server.EntityCaveSpider;
import net.minecraft.server.EntityChicken;
@ -56,6 +57,7 @@ import org.bukkit.event.Event.Type;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.*;
import org.bukkit.event.server.ServerListPingEvent;
@ -353,4 +355,19 @@ public class CraftEventFactory {
craftServer.getPluginManager().callEvent(event);
return event;
}
/**
* EntityDamage(ByEntityEvent)
*/
public static EntityDamageEvent callEntityDamageEvent(Entity damager, EntityLiving damagee, DamageCause cause, int damage) {
EntityDamageEvent event;
if (damager != null) {
event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, damage);
} else {
event = new EntityDamageEvent(damagee.getBukkitEntity(), cause, damage);
}
Bukkit.getPluginManager().callEvent(event);
return event;
}
}