Files
2018-09-08 15:37:15 +08:00

88 lines
2.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java
+++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java
@@ -4,6 +4,11 @@
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Nullable;
+
+import org.bukkit.Bukkit;
+import org.bukkit.event.weather.ThunderChangeEvent;
+import org.bukkit.event.weather.WeatherChangeEvent;
+
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.nbt.NBTBase;
@@ -162,6 +167,7 @@
this.thunderTime = nbt.getInteger("thunderTime");
this.thundering = nbt.getBoolean("thundering");
this.hardcore = nbt.getBoolean("hardcore");
+ this.dimension = nbt.getInteger("dimension");
if (nbt.hasKey("initialized", 99))
{
@@ -376,6 +382,8 @@
nbt.setBoolean("DifficultyLocked", this.difficultyLocked);
nbt.setTag("GameRules", this.theGameRules.writeToNBT());
+ nbt.setInteger("dimension", this.dimension);
+
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
for (Entry<DimensionType, NBTTagCompound> entry : this.dimensionData.entrySet())
@@ -510,6 +518,14 @@
public void setThundering(boolean thunderingIn)
{
+ org.bukkit.World world = Bukkit.getWorld(getWorldName());
+ if (world != null) {
+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, thunderingIn);
+ Bukkit.getServer().getPluginManager().callEvent(thunder);
+ if (thunder.isCancelled()) {
+ return;
+ }
+ }
this.thundering = thunderingIn;
}
@@ -530,6 +546,14 @@
public void setRaining(boolean isRaining)
{
+ org.bukkit.World world = Bukkit.getWorld(getWorldName());
+ if (world != null) {
+ WeatherChangeEvent weather = new WeatherChangeEvent(world, isRaining);
+ Bukkit.getServer().getPluginManager().callEvent(weather);
+ if (weather.isCancelled()) {
+ return;
+ }
+ }
this.raining = isRaining;
}
@@ -856,4 +880,25 @@
{
return this.versionName;
}
+
+ public void checkName( String name ) {
+ if ( !this.levelName.equals( name ) ) {
+ this.levelName = name;
+ }
+ }
+
+ // Svarka start
+ /**
+ * Sets the Dimension.
+ */
+ public void setDimension(int dim)
+ {
+ this.dimension = dim;
+ }
+
+ public int getDimension()
+ {
+ return this.dimension;
+ }
+ // Svarka end
}