2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2022-08-01 16:01:20 +02:00
|
|
|
From: Nassim Jahnke <nassim@njahnke.dev>
|
2021-06-11 14:02:28 +02:00
|
|
|
Date: Sun, 26 Jul 2020 14:44:16 +0200
|
|
|
|
Subject: [PATCH] More lightning API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java
|
2024-01-14 10:46:04 +01:00
|
|
|
index 5afeb2f6c82e8f752229462c2d7846f6ae7a4b44..924ee7fcc3f87eb8553ef473a7d9671f0f469dd1 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/LightningStrike.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/LightningStrike.java
|
2023-10-03 13:55:12 +02:00
|
|
|
@@ -22,7 +22,9 @@ public interface LightningStrike extends Entity {
|
|
|
|
* removed. By default this value is between 1 and 3.
|
|
|
|
*
|
|
|
|
* @return the flashes
|
|
|
|
+ * @deprecated use {@link #getFlashCount()}
|
|
|
|
*/
|
|
|
|
+ @Deprecated // Paper
|
|
|
|
public int getFlashes();
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -31,7 +33,9 @@ public interface LightningStrike extends Entity {
|
|
|
|
* has reduced below 0.
|
|
|
|
*
|
|
|
|
* @param flashes the flashes
|
|
|
|
+ * @deprecated use {@link #setFlashCount(int)}
|
|
|
|
*/
|
|
|
|
+ @Deprecated // Paper
|
|
|
|
public void setFlashes(int flashes);
|
|
|
|
|
|
|
|
/**
|
2024-01-14 10:46:04 +01:00
|
|
|
@@ -110,4 +114,42 @@ public interface LightningStrike extends Entity {
|
2023-09-21 10:35:38 +02:00
|
|
|
@Deprecated // Paper
|
2021-06-11 14:02:28 +02:00
|
|
|
Spigot spigot();
|
|
|
|
// Spigot end
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ /**
|
|
|
|
+ * Returns the amount of flash iterations that will be done before the lightning dies.
|
|
|
|
+ *
|
|
|
|
+ * @see #getLifeTicks() for how long the current flash will last
|
|
|
|
+ * @return amount of flashes that will be shown before the lightning dies
|
|
|
|
+ */
|
|
|
|
+ int getFlashCount();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Sets the amount of life iterations that will be done before the lightning dies.
|
|
|
|
+ * Default number of flashes on creation is between 1-3.
|
|
|
|
+ *
|
|
|
|
+ * @param flashes amount of iterations that will be done before the lightning dies, must to be a positive number
|
|
|
|
+ */
|
|
|
|
+ void setFlashCount(int flashes);
|
|
|
|
+
|
|
|
|
+ /**
|
2021-11-05 15:54:37 +01:00
|
|
|
+ * Returns the potential entity that caused this lightning strike to spawn in the world.
|
|
|
|
+ * <p>
|
|
|
|
+ * As of implementing this method, only {@link Player}s are capable of causing a lightning strike, however as this
|
|
|
|
+ * might change in future minecraft releases, this method does not guarantee a player as the cause of a lightning.
|
|
|
|
+ * Consumers of this method should hence validate whether or not the entity is a player if they want to use player
|
|
|
|
+ * specific methods through an {@code instanceOf} check.
|
|
|
|
+ * </p>
|
|
|
|
+ * <p>
|
|
|
|
+ * A player is, as of implementing this method, responsible for a lightning, and will hence be returned here as
|
|
|
|
+ * a cause, if they channeled a {@link Trident} to summon it or were explicitly defined as the cause of this
|
|
|
|
+ * lightning through {@link #setCausingPlayer(Player)}.
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @return the entity that caused this lightning or null if the lightning was not caused by a entity (e.g. normal
|
|
|
|
+ * weather)
|
|
|
|
+ */
|
|
|
|
+ @org.jetbrains.annotations.Nullable
|
|
|
|
+ Entity getCausingEntity();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper end
|
|
|
|
}
|