mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
87 lines
2.7 KiB
Diff
87 lines
2.7 KiB
Diff
--- a/net/minecraft/server/WorldData.java
|
|
+++ b/net/minecraft/server/WorldData.java
|
|
@@ -5,6 +5,11 @@
|
|
import java.util.Map;
|
|
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 {
|
|
|
|
@@ -49,6 +54,7 @@
|
|
private int M;
|
|
private final Map<DimensionManager, NBTTagCompound> N;
|
|
private GameRules O;
|
|
+ public WorldServer world; // CraftBukkit
|
|
|
|
protected WorldData() {
|
|
this.f = WorldType.NORMAL;
|
|
@@ -437,6 +443,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.v = flag;
|
|
}
|
|
|
|
@@ -453,6 +471,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.t = flag;
|
|
}
|
|
|
|
@@ -598,6 +628,12 @@
|
|
|
|
public void setDifficulty(EnumDifficulty enumdifficulty) {
|
|
this.C = enumdifficulty;
|
|
+ // CraftBukkit start
|
|
+ PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.getDifficulty(), this.isDifficultyLocked());
|
|
+ for (EntityPlayer player : (java.util.List<EntityPlayer>) (java.util.List) world.players) {
|
|
+ player.playerConnection.sendPacket(packet);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public boolean isDifficultyLocked() {
|
|
@@ -716,4 +752,12 @@
|
|
public void a(DimensionManager dimensionmanager, NBTTagCompound nbttagcompound) {
|
|
this.N.put(dimensionmanager, nbttagcompound);
|
|
}
|
|
+
|
|
+ // 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
|
|
}
|