2015-05-25 18:37:24 +08:00
|
|
|
--- a/net/minecraft/server/WorldData.java
|
|
|
|
+++ b/net/minecraft/server/WorldData.java
|
2016-03-01 05:32:46 +08:00
|
|
|
@@ -5,6 +5,11 @@
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map.Entry;
|
2015-01-05 06:50:48 +08:00
|
|
|
import java.util.concurrent.Callable;
|
2015-02-27 06:41:06 +08:00
|
|
|
+// CraftBukkit start
|
2015-01-05 06:50:48 +08:00
|
|
|
+import org.bukkit.Bukkit;
|
|
|
|
+import org.bukkit.event.weather.ThunderChangeEvent;
|
|
|
|
+import org.bukkit.event.weather.WeatherChangeEvent;
|
2015-02-27 06:41:06 +08:00
|
|
|
+// CraftBukkit end
|
2015-01-05 06:50:48 +08:00
|
|
|
|
|
|
|
public class WorldData {
|
|
|
|
|
2016-03-01 05:32:46 +08:00
|
|
|
@@ -49,6 +54,7 @@
|
|
|
|
private int M;
|
|
|
|
private final Map<DimensionManager, NBTTagCompound> N;
|
|
|
|
private GameRules O;
|
2015-02-27 06:41:06 +08:00
|
|
|
+ public WorldServer world; // CraftBukkit
|
|
|
|
|
|
|
|
protected WorldData() {
|
2016-03-01 05:32:46 +08:00
|
|
|
this.f = WorldType.NORMAL;
|
|
|
|
@@ -441,6 +447,18 @@
|
2015-01-05 06:50:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
+ }
|
2015-01-13 17:40:23 +08:00
|
|
|
+
|
|
|
|
+ setThunderDuration(0); // Will force a time reset
|
2015-01-05 06:50:48 +08:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2016-03-01 05:32:46 +08:00
|
|
|
this.v = flag;
|
2015-01-05 06:50:48 +08:00
|
|
|
}
|
|
|
|
|
2016-03-01 05:32:46 +08:00
|
|
|
@@ -457,6 +475,18 @@
|
2015-01-05 06:50:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
+ }
|
2015-01-13 17:40:23 +08:00
|
|
|
+
|
|
|
|
+ setWeatherDuration(0); // Will force a time reset
|
2015-01-05 06:50:48 +08:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2016-03-01 05:32:46 +08:00
|
|
|
this.t = flag;
|
2015-01-05 06:50:48 +08:00
|
|
|
}
|
|
|
|
|
2016-03-01 05:32:46 +08:00
|
|
|
@@ -602,6 +632,12 @@
|
2015-02-27 06:41:06 +08:00
|
|
|
|
|
|
|
public void setDifficulty(EnumDifficulty enumdifficulty) {
|
2016-03-01 05:32:46 +08:00
|
|
|
this.C = enumdifficulty;
|
2015-02-27 06:41:06 +08:00
|
|
|
+ // CraftBukkit start
|
2015-05-06 04:43:47 +08:00
|
|
|
+ PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.getDifficulty(), this.isDifficultyLocked());
|
2015-02-27 06:41:06 +08:00
|
|
|
+ for (EntityPlayer player : (java.util.List<EntityPlayer>) (java.util.List) world.players) {
|
|
|
|
+ player.playerConnection.sendPacket(packet);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2015-05-06 04:43:47 +08:00
|
|
|
public boolean isDifficultyLocked() {
|
2016-03-01 05:32:46 +08:00
|
|
|
@@ -720,4 +756,12 @@
|
|
|
|
public void a(DimensionManager dimensionmanager, NBTTagCompound nbttagcompound) {
|
|
|
|
this.N.put(dimensionmanager, nbttagcompound);
|
2014-11-30 03:36:57 +08:00
|
|
|
}
|
2014-11-30 03:33:33 +08:00
|
|
|
+
|
|
|
|
+ // CraftBukkit start - Check if the name stored in NBT is the correct one
|
|
|
|
+ public void checkName( String name ) {
|
2016-03-01 05:32:46 +08:00
|
|
|
+ if ( !this.levelName.equals( name ) ) {
|
|
|
|
+ this.levelName = name;
|
2014-11-30 03:33:33 +08:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2014-11-30 03:36:57 +08:00
|
|
|
}
|