Paper/nms-patches/WorldData.patch

64 lines
1.9 KiB
Diff
Raw Normal View History

--- ../work/decompile-8eb82bde/net/minecraft/server/WorldData.java 2015-01-13 20:36:38.880978444 +1100
+++ src/main/java/net/minecraft/server/WorldData.java 2015-01-13 20:36:38.880978444 +1100
@@ -1,6 +1,9 @@
package net.minecraft.server;
import java.util.concurrent.Callable;
+import org.bukkit.Bukkit;
+import org.bukkit.event.weather.ThunderChangeEvent;
+import org.bukkit.event.weather.WeatherChangeEvent;
public class WorldData {
@@ -395,6 +398,18 @@
}
public void setThundering(boolean flag) {
+ // CraftBukkit start
+ org.bukkit.World world = Bukkit.getWorld(getName());
+ if (world != null) {
+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, flag);
+ Bukkit.getServer().getPluginManager().callEvent(thunder);
+ if (thunder.isCancelled()) {
+ return;
+ }
+
+ setThunderDuration(0); // Will force a time reset
+ }
+ // CraftBukkit end
this.s = flag;
}
@@ -411,6 +426,18 @@
}
public void setStorm(boolean flag) {
+ // CraftBukkit start
+ org.bukkit.World world = Bukkit.getWorld(getName());
+ if (world != null) {
+ WeatherChangeEvent weather = new WeatherChangeEvent(world, flag);
+ Bukkit.getServer().getPluginManager().callEvent(weather);
+ if (weather.isCancelled()) {
+ return;
+ }
+
+ setWeatherDuration(0); // Will force a time reset
+ }
+ // CraftBukkit end
this.q = flag;
}
@@ -645,4 +672,12 @@
2014-11-30 03:36:57 +08:00
static boolean q(WorldData worlddata) {
return worlddata.x;
}
+
+ // CraftBukkit start - Check if the name stored in NBT is the correct one
+ public void checkName( String name ) {
+ if ( !this.n.equals( name ) ) {
+ this.n = name;
+ }
+ }
+ // CraftBukkit end
2014-11-30 03:36:57 +08:00
}