PaperMC/patches/api/0289-Add-cause-to-Weather-ThunderChangeEvents.patch
Nassim Jahnke 71c84c8132
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD

CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor

Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00

104 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 2 Dec 2020 18:25:31 -0800
Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
diff --git a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
index 6cdf83476b4e366bed79960e3706bea5ebe56788..032395c7114b6d757acf1918ce2b014870e85fcd 100644
--- a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
+++ b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
@@ -12,10 +12,20 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean canceled;
private final boolean to;
+ // Paper start
+ private final Cause cause;
+ public ThunderChangeEvent(@NotNull final World world, final boolean to, @NotNull final Cause cause) {
+ super(world);
+ this.to = to;
+ this.cause = cause;
+ }
+
+ @Deprecated // Paper end
public ThunderChangeEvent(@NotNull final World world, final boolean to) {
super(world);
this.to = to;
+ this.cause = Cause.UNKNOWN; // Paper
}
@Override
@@ -47,4 +57,23 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;
}
+ // Paper start
+ /**
+ * Gets the cause of the weather change.
+ *
+ * @return the weather change cause
+ */
+ @NotNull
+ public Cause getCause() {
+ return this.cause;
+ }
+
+ public enum Cause {
+ COMMAND,
+ NATURAL,
+ SLEEP,
+ PLUGIN,
+ UNKNOWN
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
index d562d87e7418641e52f4dae44f573eaa31add44a..dabd390b84354c14c269c03cbed2006014d004b2 100644
--- a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
+++ b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
@@ -12,10 +12,20 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean canceled;
private final boolean to;
+ // Paper start
+ private final Cause cause;
+ public WeatherChangeEvent(@NotNull final World world, final boolean to, @NotNull Cause cause) {
+ super(world);
+ this.to = to;
+ this.cause = cause;
+ }
+
+ @Deprecated // Paper end
public WeatherChangeEvent(@NotNull final World world, final boolean to) {
super(world);
this.to = to;
+ this.cause = Cause.UNKNOWN; // Paper
}
@Override
@@ -47,4 +57,23 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;
}
+ // Paper start
+ /**
+ * Gets the cause of the weather change.
+ *
+ * @return the weather change cause
+ */
+ @NotNull
+ public Cause getCause() {
+ return cause;
+ }
+
+ public enum Cause {
+ COMMAND,
+ NATURAL,
+ SLEEP,
+ PLUGIN,
+ UNKNOWN
+ }
+ // Paper end
}