Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-23 14:50:08 +01:00
91 Zeilen
3.0 KiB
Diff
91 Zeilen
3.0 KiB
Diff
--- a/net/minecraft/server/WorldData.java
|
|
+++ b/net/minecraft/server/WorldData.java
|
|
@@ -11,6 +11,11 @@
|
|
import java.util.Set;
|
|
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 {
|
|
|
|
@@ -62,6 +67,7 @@
|
|
private final Map<DimensionManager, NBTTagCompound> S;
|
|
private NBTTagCompound T;
|
|
private final GameRules U;
|
|
+ public WorldServer world; // CraftBukkit
|
|
|
|
protected WorldData() {
|
|
this.f = WorldType.NORMAL;
|
|
@@ -296,6 +302,7 @@
|
|
nbttagcompound2.setBoolean("Snapshot", true);
|
|
nbttagcompound.set("Version", nbttagcompound2);
|
|
nbttagcompound.setInt("DataVersion", 1513);
|
|
+ if (org.bukkit.craftbukkit.util.CraftMagicNumbers.DATA_VERSION != 1513) throw new AssertionError(); // CraftBukkit - sentinel
|
|
nbttagcompound.setLong("RandomSeed", this.e);
|
|
nbttagcompound.setString("generatorName", this.f.name());
|
|
nbttagcompound.setInt("generatorVersion", this.f.getVersion());
|
|
@@ -466,6 +473,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.y = flag;
|
|
}
|
|
|
|
@@ -482,6 +499,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.w = flag;
|
|
}
|
|
|
|
@@ -631,6 +658,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<EntityPlayer>) (java.util.List) world.players) {
|
|
+ player.playerConnection.sendPacket(packet);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public boolean isDifficultyLocked() {
|
|
@@ -712,4 +745,12 @@
|
|
public void c(@Nullable NBTTagCompound nbttagcompound) {
|
|
this.T = 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
|
|
}
|