HealthBarUpdated event made immutable and additional documentation
This commit is contained in:
@@ -24,22 +24,26 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.api.events;
|
package net.runelite.api.events;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Value;
|
||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.Hitsplat;
|
import net.runelite.api.Hitsplat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event called when an {@link Actor} health bar is updated from a {@link Hitsplat}.
|
* An event called when an {@link Actor} health bar is updated from a {@link Hitsplat}.
|
||||||
|
* <p>
|
||||||
|
* This event is called when the health bar first appears and when the client gets new information
|
||||||
|
* about the health bar of the actor. It does not fire when the health bar disappears.
|
||||||
|
* The event will still fire even if the health ratio did not change for example from a 0 hitsplat.
|
||||||
*/
|
*/
|
||||||
@Data
|
@Value
|
||||||
public class HealthBarUpdated
|
public class HealthBarUpdated
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The actor the hitsplat was applied to.
|
* The actor the hitsplat was applied to.
|
||||||
*/
|
*/
|
||||||
private Actor actor;
|
Actor actor;
|
||||||
/**
|
/**
|
||||||
* The updated health ratio.
|
* The updated health ratio.
|
||||||
*/
|
*/
|
||||||
private int healthRatio;
|
int healthRatio;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,9 +270,7 @@ public abstract class RSActorMixin implements RSActor
|
|||||||
this.setDead(true);
|
this.setDead(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final HealthBarUpdated event = new HealthBarUpdated();
|
final HealthBarUpdated event = new HealthBarUpdated(this, healthRatio);
|
||||||
event.setActor(this);
|
|
||||||
event.setHealthRatio(healthRatio);
|
|
||||||
client.getCallbacks().post(event);
|
client.getCallbacks().post(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user