Changed getAttacker comment and rearranged the method to prioritize playerAttacker.

This commit is contained in:
GZimmer 2023-07-29 13:08:53 +02:00
parent fe481c91c8
commit 3503bf4417
1 changed files with 8 additions and 4 deletions

View File

@ -32,13 +32,17 @@ public class TreeDamageEvent extends PlayerEvent implements Cancellable {
}
/**
* @return the attacker as either FallingBlock or Player
* Get the attacker. This returns either a FallingBlock or a Player.
* @return the attacker as Entity.
*/
public Entity getAttacker() {
if (this.blockAttacker != null)
return this.blockAttacker;
if (this.playerAttacker != null)
if (this.playerAttacker != null) {
return this.playerAttacker;
}
if (this.blockAttacker != null) {
return this.blockAttacker;
}
return null;
}