aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server/patches/unapplied/net/minecraft/server/commands/WeatherCommand.java.patch
blob: 2f916fdf48a21d891cf98d66b4a2f024aaf32eed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- a/net/minecraft/server/commands/WeatherCommand.java
+++ b/net/minecraft/server/commands/WeatherCommand.java
@@ -34,11 +34,11 @@
     }
 
     private static int getDuration(CommandSourceStack source, int duration, IntProvider provider) {
-        return duration == -1 ? provider.sample(source.getServer().overworld().getRandom()) : duration;
+        return duration == -1 ? provider.sample(source.getLevel().getRandom()) : duration; // CraftBukkit - SPIGOT-7680: per-world
     }
 
     private static int setClear(CommandSourceStack source, int duration) {
-        source.getServer().overworld().setWeatherParameters(WeatherCommand.getDuration(source, duration, ServerLevel.RAIN_DELAY), 0, false, false);
+        source.getLevel().setWeatherParameters(WeatherCommand.getDuration(source, duration, ServerLevel.RAIN_DELAY), 0, false, false); // CraftBukkit - SPIGOT-7680: per-world
         source.sendSuccess(() -> {
             return Component.translatable("commands.weather.set.clear");
         }, true);
@@ -46,7 +46,7 @@
     }
 
     private static int setRain(CommandSourceStack source, int duration) {
-        source.getServer().overworld().setWeatherParameters(0, WeatherCommand.getDuration(source, duration, ServerLevel.RAIN_DURATION), true, false);
+        source.getLevel().setWeatherParameters(0, WeatherCommand.getDuration(source, duration, ServerLevel.RAIN_DURATION), true, false); // CraftBukkit - SPIGOT-7680: per-world
         source.sendSuccess(() -> {
             return Component.translatable("commands.weather.set.rain");
         }, true);
@@ -54,7 +54,7 @@
     }
 
     private static int setThunder(CommandSourceStack source, int duration) {
-        source.getServer().overworld().setWeatherParameters(0, WeatherCommand.getDuration(source, duration, ServerLevel.THUNDER_DURATION), true, true);
+        source.getLevel().setWeatherParameters(0, WeatherCommand.getDuration(source, duration, ServerLevel.THUNDER_DURATION), true, true); // CraftBukkit - SPIGOT-7680: per-world
         source.sendSuccess(() -> {
             return Component.translatable("commands.weather.set.thunder");
         }, true);