@@ -5,10 +5,10 @@ Subject: [PATCH] More lightning API
5
5
6
6
7
7
diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java
8
- index be347c3d0291f44036bae29a4e7e4645d6a4cdf6..2c81a3f685588431a3c7675c84b35a28975232af 100644
8
+ index be347c3d0291f44036bae29a4e7e4645d6a4cdf6..6f5b6901032eb03606c4566b24459a03baac0c73 100644
9
9
--- a/src/main/java/org/bukkit/entity/LightningStrike.java
10
10
+++ b/src/main/java/org/bukkit/entity/LightningStrike.java
11
- @@ -31,4 +31,38 @@ public interface LightningStrike extends Entity {
11
+ @@ -31,4 +31,72 @@ public interface LightningStrike extends Entity {
12
12
@Override
13
13
Spigot spigot();
14
14
// Spigot end
@@ -45,5 +45,39 @@ index be347c3d0291f44036bae29a4e7e4645d6a4cdf6..2c81a3f685588431a3c7675c84b35a28
45
45
+ * @param lifeTicks ticks the current flash will do damage for
46
46
+ */
47
47
+ void setLifeTicks(int lifeTicks);
48
+ +
49
+ + /**
50
+ + * Returns the potential entity that caused this lightning strike to spawn in the world.
51
+ + * <p>
52
+ + * As of implementing this method, only {@link Player}s are capable of causing a lightning strike, however as this
53
+ + * might change in future minecraft releases, this method does not guarantee a player as the cause of a lightning.
54
+ + * Consumers of this method should hence validate whether or not the entity is a player if they want to use player
55
+ + * specific methods through an {@code instanceOf} check.
56
+ + * </p>
57
+ + * <p>
58
+ + * A player is, as of implementing this method, responsible for a lightning, and will hence be returned here as
59
+ + * a cause, if they channeled a {@link Trident} to summon it or were explicitly defined as the cause of this
60
+ + * lightning through {@link #setCausingPlayer(Player)}.
61
+ + * </p>
62
+ + *
63
+ + * @return the entity that caused this lightning or null if the lightning was not caused by a entity (e.g. normal
64
+ + * weather)
65
+ + */
66
+ + @org.jetbrains.annotations.Nullable
67
+ + Entity getCausingEntity();
68
+ +
69
+ + /**
70
+ + * Updates the player that caused this lightning to be summoned into the world.
71
+ + * By default, players that channel their {@link Trident} will be the cause of the respective lightning.
72
+ + * <p>
73
+ + * While the respective getter method {@link #getCausingEntity()} does not guarantee a player as the cause of a
74
+ + * lightning to stay as future proof as possible, as of implementing this method, players are the only entities
75
+ + * that can cause a lightning strike and hence this setter is restricted to players.
76
+ + * </p>
77
+ + *
78
+ + * @param causingPlayer the player that should be the new cause of this lightning. {@code null} may be passed to
79
+ + * indicate that no player is responsible for this lightning.
80
+ + */
81
+ + void setCausingPlayer(@org.jetbrains.annotations.Nullable Player causingPlayer);
48
82
+ // Paper end
49
83
}
0 commit comments