mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 18:27:41 +01:00
[Bleeding] Added event calls for healing and harming by potions
By: Zeerix <zeerix@draig.de>
This commit is contained in:
parent
b785b7f01c
commit
0c70cec69d
@ -4,6 +4,7 @@ import java.net.InetAddress;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.server.ChunkCoordinates;
|
import net.minecraft.server.ChunkCoordinates;
|
||||||
|
import net.minecraft.server.Entity;
|
||||||
import net.minecraft.server.EntityBlaze;
|
import net.minecraft.server.EntityBlaze;
|
||||||
import net.minecraft.server.EntityCaveSpider;
|
import net.minecraft.server.EntityCaveSpider;
|
||||||
import net.minecraft.server.EntityChicken;
|
import net.minecraft.server.EntityChicken;
|
||||||
@ -56,6 +57,7 @@ import org.bukkit.event.Event.Type;
|
|||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.server.ServerListPingEvent;
|
import org.bukkit.event.server.ServerListPingEvent;
|
||||||
|
|
||||||
@ -353,4 +355,19 @@ public class CraftEventFactory {
|
|||||||
craftServer.getPluginManager().callEvent(event);
|
craftServer.getPluginManager().callEvent(event);
|
||||||
return 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user