--- a/net/minecraft/server/WorldData.java +++ b/net/minecraft/server/WorldData.java @@ -12,6 +12,11 @@ import java.util.UUID; import java.util.Map.Entry; import javax.annotation.Nullable; +// CraftBukkit start +import org.bukkit.Bukkit; +import org.bukkit.event.weather.ThunderChangeEvent; +import org.bukkit.event.weather.WeatherChangeEvent; +// CraftBukkit end public class WorldData { @@ -68,6 +73,7 @@ private UUID W; private final GameRules X; private final CustomFunctionCallbackTimerQueue Y; + public WorldServer world; // CraftBukkit protected WorldData() { this.f = WorldType.NORMAL; @@ -419,6 +425,7 @@ nbttagcompound.setString("WanderingTraderId", this.W.toString()); } + nbttagcompound.setString("Bukkit.Version", Bukkit.getName() + "/" + Bukkit.getVersion() + "/" + Bukkit.getBukkitVersion()); // CraftBukkit } public long getSeed() { @@ -511,6 +518,20 @@ } public void setThundering(boolean flag) { + // CraftBukkit start + if (this.thundering == flag) { + return; + } + + 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.thundering = flag; } @@ -527,6 +548,20 @@ } public void setStorm(boolean flag) { + // CraftBukkit start + if (this.raining == flag) { + return; + } + + 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.raining = flag; } @@ -676,6 +711,12 @@ public void setDifficulty(EnumDifficulty enumdifficulty) { this.F = enumdifficulty; + // CraftBukkit start + PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.getDifficulty(), this.isDifficultyLocked()); + for (EntityPlayer player : (java.util.List) (java.util.List) world.getPlayers()) { + player.playerConnection.sendPacket(packet); + } + // CraftBukkit end } public boolean isDifficultyLocked() { @@ -780,4 +821,12 @@ public void a(UUID uuid) { this.W = uuid; } + + // CraftBukkit start - Check if the name stored in NBT is the correct one + public void checkName( String name ) { + if ( !this.levelName.equals( name ) ) { + this.levelName = name; + } + } + // CraftBukkit end }