forked from Grasscutters/Grasscutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
EntityDamageEvent
and implementations
- Loading branch information
1 parent
d05b320
commit cf2832a
Showing
2 changed files
with
58 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/emu/grasscutter/server/event/entity/EntityDamageEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package emu.grasscutter.server.event.entity; | ||
|
||
import emu.grasscutter.game.entity.GameEntity; | ||
import emu.grasscutter.server.event.Cancellable; | ||
import emu.grasscutter.server.event.types.EntityEvent; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public final class EntityDamageEvent extends EntityEvent implements Cancellable { | ||
private float damage; | ||
@Nullable private final GameEntity damager; | ||
|
||
public EntityDamageEvent(GameEntity entity, float damage, @Nullable GameEntity damager) { | ||
super(entity); | ||
|
||
this.damage = damage; | ||
this.damager = damager; | ||
} | ||
|
||
public float getDamage() { | ||
return this.damage; | ||
} | ||
|
||
public void setDamage(float damage) { | ||
this.damage = damage; | ||
} | ||
|
||
@Nullable | ||
public GameEntity getDamager() { | ||
return this.damager; | ||
} | ||
} |