From 612b1b9831f9aa18596eeb8e6276190bbfa248d9 Mon Sep 17 00:00:00 2001 From: 12emin34 <43503468+12emin34@users.noreply.github.com> Date: Mon, 23 Aug 2021 23:03:18 +0200 Subject: [PATCH] Option for if rain and thunder should stop on sleep (#607) --- ...ain-and-thunder-should-stop-on-sleep.patch | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 patches/server/0255-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch diff --git a/patches/server/0255-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch b/patches/server/0255-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch new file mode 100644 index 000000000..fa0b72abd --- /dev/null +++ b/patches/server/0255-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: 12emin34 +Date: Mon, 23 Aug 2021 17:59:29 +0200 +Subject: [PATCH] Option for if rain and thunder should stop on sleep + + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 7bd74f7bdd23636f7d6c4f2325fd6430780fc95d..754a5c63c2a7b89082306ec189273bdc89735ff3 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -1112,6 +1112,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + + private void stopWeather() { + // CraftBukkit start ++ if (this.purpurConfig.rainStopsAfterSleep) // Purpur + this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - when passing the night + // If we stop due to everyone sleeping we should reset the weather duration to some other random value. + // Not that everyone ever manages to get the whole server to sleep at the same time.... +@@ -1119,6 +1120,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + this.serverLevelData.setRainTime(0); + } + // CraftBukkit end ++ if (this.purpurConfig.thunderStopsAfterSleep) // Purpur + this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - when passing the night + // CraftBukkit start + // If we stop due to everyone sleeping we should reset the weather duration to some other random value. +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index 2fbea88bac45839e6bdec6bd7deff7a552f5373f..bbb420508b9e5522135bc8644d97cdfe820f42a2 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -648,6 +648,8 @@ public class PurpurWorldConfig { + public int raidCooldownSeconds = 0; + public int animalBreedingCooldownSeconds = 0; + public boolean mobsIgnoreRails = false; ++ public boolean rainStopsAfterSleep = true; ++ public boolean thunderStopsAfterSleep = true; + private void miscGameplayMechanicsSettings() { + useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending); + alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative); +@@ -671,6 +673,8 @@ public class PurpurWorldConfig { + raidCooldownSeconds = getInt("gameplay-mechanics.raid-cooldown-seconds", raidCooldownSeconds); + animalBreedingCooldownSeconds = getInt("gameplay-mechanics.animal-breeding-cooldown-seconds", animalBreedingCooldownSeconds); + mobsIgnoreRails = getBoolean("gameplay-mechanics.mobs-ignore-rails", mobsIgnoreRails); ++ rainStopsAfterSleep = getBoolean("gameplay-mechanics.rain-stops-after-sleep", rainStopsAfterSleep); ++ thunderStopsAfterSleep = getBoolean("gameplay-mechanics.thunder-stops-after-sleep", thunderStopsAfterSleep); + } + + public Set noRandomTickBlocks = new HashSet<>();