mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-18 08:36:13 +01:00
91 lines
2.8 KiB
Diff
91 lines
2.8 KiB
Diff
--- a/net/minecraft/server/WorldData.java
|
|
+++ b/net/minecraft/server/WorldData.java
|
|
@@ -11,6 +11,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 X;
|
|
private final GameRules Y;
|
|
private final CustomFunctionCallbackTimerQueue<MinecraftServer> Z;
|
|
+ public WorldServer world; // CraftBukkit
|
|
|
|
protected WorldData() {
|
|
this.f = WorldType.NORMAL;
|
|
@@ -419,6 +425,7 @@
|
|
nbttagcompound.setString("WanderingTraderId", this.X.toString());
|
|
}
|
|
|
|
+ nbttagcompound.setString("Bukkit.Version", Bukkit.getName() + "/" + Bukkit.getVersion() + "/" + Bukkit.getBukkitVersion()); // CraftBukkit
|
|
}
|
|
|
|
public long getSeed() {
|
|
@@ -508,6 +515,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.z = flag;
|
|
}
|
|
|
|
@@ -524,6 +541,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.x = flag;
|
|
}
|
|
|
|
@@ -673,6 +700,12 @@
|
|
|
|
public void setDifficulty(EnumDifficulty enumdifficulty) {
|
|
this.G = enumdifficulty;
|
|
+ // CraftBukkit start
|
|
+ PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.getDifficulty(), this.isDifficultyLocked());
|
|
+ for (EntityPlayer player : (java.util.List<EntityPlayer>) (java.util.List) world.getPlayers()) {
|
|
+ player.playerConnection.sendPacket(packet);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public boolean isDifficultyLocked() {
|
|
@@ -777,4 +810,12 @@
|
|
public void a(UUID uuid) {
|
|
this.X = 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
|
|
}
|