Add cause to Weather/ThunderChangeEvents
This commit is contained in:
@@ -120,10 +120,15 @@
|
||||
|
||||
Objects.requireNonNull(nbttaglist);
|
||||
stream.forEach(nbttaglist::add);
|
||||
@@ -310,6 +337,20 @@
|
||||
@@ -310,6 +337,25 @@
|
||||
|
||||
@Override
|
||||
public void setThundering(boolean thundering) {
|
||||
+ // Paper start - Add cause to Weather/ThunderChangeEvents
|
||||
+ this.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.UNKNOWN);
|
||||
+ }
|
||||
+ public void setThundering(boolean thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause cause) {
|
||||
+ // Paper end - Add cause to Weather/ThunderChangeEvents
|
||||
+ // CraftBukkit start
|
||||
+ if (this.thundering == thundering) {
|
||||
+ return;
|
||||
@@ -131,7 +136,7 @@
|
||||
+
|
||||
+ org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
|
||||
+ if (world != null) {
|
||||
+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering);
|
||||
+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering, cause); // Paper - Add cause to Weather/ThunderChangeEvents
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(thunder);
|
||||
+ if (thunder.isCancelled()) {
|
||||
+ return;
|
||||
@@ -141,10 +146,16 @@
|
||||
this.thundering = thundering;
|
||||
}
|
||||
|
||||
@@ -330,6 +371,20 @@
|
||||
@@ -330,6 +376,26 @@
|
||||
|
||||
@Override
|
||||
public void setRaining(boolean raining) {
|
||||
+ // Paper start - Add cause to Weather/ThunderChangeEvents
|
||||
+ this.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ public void setRaining(boolean raining, org.bukkit.event.weather.WeatherChangeEvent.Cause cause) {
|
||||
+ // Paper end - Add cause to Weather/ThunderChangeEvents
|
||||
+ // CraftBukkit start
|
||||
+ if (this.raining == raining) {
|
||||
+ return;
|
||||
@@ -152,7 +163,7 @@
|
||||
+
|
||||
+ org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
|
||||
+ if (world != null) {
|
||||
+ WeatherChangeEvent weather = new WeatherChangeEvent(world, raining);
|
||||
+ WeatherChangeEvent weather = new WeatherChangeEvent(world, raining, cause); // Paper - Add cause to Weather/ThunderChangeEvents
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(weather);
|
||||
+ if (weather.isCancelled()) {
|
||||
+ return;
|
||||
@@ -162,7 +173,7 @@
|
||||
this.raining = raining;
|
||||
}
|
||||
|
||||
@@ -396,6 +451,12 @@
|
||||
@@ -396,6 +462,12 @@
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty) {
|
||||
this.settings = this.settings.withDifficulty(difficulty);
|
||||
@@ -175,7 +186,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -532,6 +593,14 @@
|
||||
@@ -532,6 +604,14 @@
|
||||
return this.settings.copy();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user