public class PlayerHitNpcEvent extends PlayerNpcEvent implements Cancellable
| Constructor and Description |
|---|
PlayerHitNpcEvent(Player player,
Npc targetNpc,
Vector3f damagePoint,
short damage,
float distance) |
| Modifier and Type | Method and Description |
|---|---|
short |
getDamage()
Gets the amount of damage this hit will cause.
|
Vector3f |
getDamagePosition()
Gets the coordinates where the npc was hit exactly.
|
float |
getDistance()
Gets the distance between the player and the target npc (or more precisely, the damage point).
|
Npc |
getNpc()
Gets the target npc, i.e. the npc which was hit by the player.
|
Npc |
getTargetNpc()
Deprecated.
Use
getNpc() instead! |
boolean |
isCancelled()
Determines if the event is cancelled.
|
void |
setCancelled(boolean cancel)
Cancels this event.
|
void |
setDamage(short damage)
Sets the amount of damage that will be caused by this hit.
|
void |
setDamagePosition(float x,
float y,
float z)
Sets the coordinates where the npc was hit exactly.
|
void |
setDamagePosition(Vector3f position)
Sets the coordinates where the npc was hit exactly.
|
getPlayerpublic Npc getNpc()
getNpc in class PlayerNpcEventpublic void setDamagePosition(Vector3f position)
position - the new position.public void setDamagePosition(float x,
float y,
float z)
x - the x coordinate.y - the y coordinate.z - the z coordinate.public Vector3f getDamagePosition()
public void setDamage(short damage)
damage - the new damage amount.public short getDamage()
public float getDistance()
public Npc getTargetNpc()
getNpc() instead!public boolean isCancelled()
CancellableisCancelled in interface Cancellablepublic void setCancelled(boolean cancel)
CancellablesetCancelled in interface Cancellablecancel - set to true if you want to cancel this event.