Paper/nms-patches/WorldData.patch

60 Zeilen
1.7 KiB
Diff

--- ../work/decompile-8eb82bde/net/minecraft/server/WorldData.java 2015-01-05 09:50:01.989188327 +1100
+++ src/main/java/net/minecraft/server/WorldData.java 2015-01-05 09:50:01.993188321 +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,16 @@
}
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;
+ }
+ }
+ // CraftBukkit end
this.s = flag;
}
@@ -411,6 +424,16 @@
}
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;
+ }
+ }
+ // CraftBukkit end
this.q = flag;
}
@@ -645,4 +668,12 @@
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
}