Expose the potential player cause of a lightning (#6782)

This commit is contained in:
Bjarne Koll
2021-11-05 15:54:37 +01:00
parent 4b68f08fe5
commit 7deb2b0f26
2 changed files with 45 additions and 0 deletions

View File

@@ -34,5 +34,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void setLifeTicks(int lifeTicks) {
+ getHandle().life = lifeTicks;
+ }
+
+ @Override
+ public @org.jetbrains.annotations.Nullable org.bukkit.entity.Entity getCausingEntity() {
+ final var cause = this.getHandle().getCause();
+ return cause == null ? null : cause.getBukkitEntity();
+ }
+
+ @Override
+ public void setCausingPlayer(@org.jetbrains.annotations.Nullable org.bukkit.entity.Player causingPlayer) {
+ this.getHandle().setCause(causingPlayer == null ? null : ((CraftPlayer) causingPlayer).getHandle());
+ }
+ // Paper end
}