3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00
Paper/nms-patches/WorldData.patch

87 Zeilen
2.6 KiB
Diff

2015-05-05 22:43:47 +02:00
--- /home/matt/mc-dev-private//net/minecraft/server/WorldData.java 2015-05-05 21:41:21.384628182 +0100
+++ src/main/java/net/minecraft/server/WorldData.java 2015-05-05 21:41:21.384628182 +0100
2015-02-26 23:41:06 +01:00
@@ -1,6 +1,11 @@
package net.minecraft.server;
import java.util.concurrent.Callable;
2015-02-26 23:41:06 +01:00
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.event.weather.ThunderChangeEvent;
+import org.bukkit.event.weather.WeatherChangeEvent;
2015-02-26 23:41:06 +01:00
+// CraftBukkit end
public class WorldData {
2015-02-26 23:41:06 +01:00
@@ -41,6 +46,7 @@
private int I;
private int J;
private GameRules K;
+ public WorldServer world; // CraftBukkit
protected WorldData() {
this.c = WorldType.NORMAL;
@@ -395,6 +401,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.s = flag;
}
2015-02-26 23:41:06 +01:00
@@ -411,6 +429,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.q = flag;
}
2015-02-26 23:41:06 +01:00
@@ -556,6 +586,12 @@
public void setDifficulty(EnumDifficulty enumdifficulty) {
this.z = enumdifficulty;
+ // CraftBukkit start
2015-05-05 22:43:47 +02:00
+ PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.getDifficulty(), this.isDifficultyLocked());
2015-02-26 23:41:06 +01:00
+ for (EntityPlayer player : (java.util.List<EntityPlayer>) (java.util.List) world.players) {
+ player.playerConnection.sendPacket(packet);
+ }
+ // CraftBukkit end
}
2015-05-05 22:43:47 +02:00
public boolean isDifficultyLocked() {
2015-02-26 23:41:06 +01:00
@@ -664,4 +700,12 @@
}
});
2014-11-29 20:36:57 +01:00
}
+
+ // CraftBukkit start - Check if the name stored in NBT is the correct one
+ public void checkName( String name ) {
+ if ( !this.n.equals( name ) ) {
+ this.n = name;
+ }
+ }
+ // CraftBukkit end
2014-11-29 20:36:57 +01:00
}