Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
99 Zeilen
2.9 KiB
Diff
99 Zeilen
2.9 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 {
|
|
|
|
@@ -67,6 +72,7 @@
|
|
private UUID W;
|
|
private final GameRules X;
|
|
private final CustomFunctionCallbackTimerQueue<MinecraftServer> Y;
|
|
+ public WorldServer world; // CraftBukkit
|
|
|
|
protected WorldData() {
|
|
this.f = WorldType.NORMAL;
|
|
@@ -418,6 +424,7 @@
|
|
nbttagcompound.setString("WanderingTraderId", this.W.toString());
|
|
}
|
|
|
|
+ nbttagcompound.setString("Bukkit.Version", Bukkit.getName() + "/" + Bukkit.getVersion() + "/" + Bukkit.getBukkitVersion()); // CraftBukkit
|
|
}
|
|
|
|
public long getSeed() {
|
|
@@ -506,6 +513,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;
|
|
}
|
|
|
|
@@ -522,6 +543,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;
|
|
}
|
|
|
|
@@ -671,6 +706,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.getPlayers()) {
|
|
+ player.playerConnection.sendPacket(packet);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public boolean isDifficultyLocked() {
|
|
@@ -775,4 +816,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
|
|
}
|