FourKit 1469f90c
The LCE C# Server Plugin API
Loading...
Searching...
No Matches
Usage of all Events

This will go over how to utilize each event that FourKit provides.

EntityDamageEvent and EntityDamageByEntityEvent

EntityDamageEvent and EntityDamageByEntityEvent are fired when any entity is damaged.

When one of these events are fired, it passes an entity. It can be a Player, or any LivingEntity

You can check what type of entity it is with getEntityType(). This will return a EntityType enum.

From there, you can cast the entity to the actual type (in this case LivingEntity):

[EventHandler]
public void entityDamage(EntityDamageEvent e)
{
LivingEntity entity = (LivingEntity)e.getEntity();
}

Or if its a player, you can even cast it to Player:

[EventHandler]
public void entityDamage(EntityDamageEvent e)
{
if (e.getEntityType() == EntityType.PLAYER)
{
Player player = (Player)e.getEntity();
}
}

As of right now, this event is only fired for LivingEntity and Players.

Page currently under construction