mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
add getBlocks method to LightningStrikeEvent event
This commit is contained in:
56
patches/api/0054-lightning-transforms-blocks.patch
Normal file
56
patches/api/0054-lightning-transforms-blocks.patch
Normal file
@@ -0,0 +1,56 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: granny <granny@purpurmc.org>
|
||||
Date: Sun, 27 Aug 2023 02:09:51 -0700
|
||||
Subject: [PATCH] lightning transforms blocks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java b/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java
|
||||
index c98f07f82d179dffe162bb5cd85efe97de1b6175..4f980ab45073b293d03a00857e896375758f7249 100644
|
||||
--- a/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java
|
||||
@@ -14,6 +14,7 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
||||
private boolean canceled;
|
||||
private final LightningStrike bolt;
|
||||
private final Cause cause;
|
||||
+ private final java.util.List<org.bukkit.block.BlockState> blocks; // Purpur
|
||||
|
||||
@Deprecated
|
||||
public LightningStrikeEvent(@NotNull final World world, @NotNull final LightningStrike bolt) {
|
||||
@@ -21,9 +22,15 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
||||
}
|
||||
|
||||
public LightningStrikeEvent(@NotNull final World world, @NotNull final LightningStrike bolt, @NotNull final Cause cause) {
|
||||
+ // Purpur start
|
||||
+ this(world, bolt, cause, new java.util.ArrayList<>());
|
||||
+ }
|
||||
+ public LightningStrikeEvent(@NotNull final World world, @NotNull final LightningStrike bolt, @NotNull final Cause cause, java.util.List<org.bukkit.block.BlockState> blocks) {
|
||||
+ // Purpur end
|
||||
super(world);
|
||||
this.bolt = bolt;
|
||||
this.cause = cause;
|
||||
+ this.blocks = blocks; // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,6 +63,21 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
||||
return cause;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
+ * Get a list of all blocks that will be modified by the lightning strike.
|
||||
+ * <br>
|
||||
+ * This list is mutable and contains the blocks in their changed state, i.e.
|
||||
+ * having a type of {@link org.bukkit.Material#GLASS}.
|
||||
+ *
|
||||
+ * @return list of the modified blocks.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public java.util.List<org.bukkit.block.BlockState> getBlocks() {
|
||||
+ return blocks;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
Reference in New Issue
Block a user