From e56a8d47201b4adc48da2576ddedb623b95090ab Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Mon, 2 May 2011 01:48:08 -0400 Subject: [PATCH] Added SnowFormEvent. Thanks aPunch! --- src/main/java/net/minecraft/server/World.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 7a2c67fad3..f8178e9e55 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -14,6 +14,7 @@ import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.block.SnowFormEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.event.weather.ThunderChangeEvent; @@ -1521,7 +1522,6 @@ public class World implements IBlockAccess { // CraftBukkit start CraftServer server = ((WorldServer) this).getServer(); - WeatherChangeEvent weather = new WeatherChangeEvent(((WorldServer) this).getWorld(), !this.worldData.l()); server.getPluginManager().callEvent(weather); if (!weather.isCancelled()) { @@ -1664,7 +1664,14 @@ public class World implements IBlockAccess { l1 = chunk.getTypeId(l, k1 - 1, j1); i2 = chunk.getTypeId(l, k1, j1); if (i2 == 0 && Block.SNOW.canPlace(this, l + i, k1, j1 + j) && l1 != 0 && l1 != Block.ICE.id && Block.byId[l1].material.isSolid()) { - this.setTypeId(l + i, k1, j1 + j, Block.SNOW.id); + // CraftBukkit start + SnowFormEvent snow = new SnowFormEvent(((WorldServer)this).getWorld().getBlockAt(l + i, k1, j1 + j)); + ((WorldServer)this).getServer().getPluginManager().callEvent(snow); + if (!snow.isCancelled()) { + this.setTypeId(l + i, k1, j1 + j, snow.getMaterial().getId()); + this.setData(l + i, k1, j1 + j, snow.getData()); + } + // CraftBukkit end } if (l1 == Block.STATIONARY_WATER.id && chunk.getData(l, k1 - 1, j1) == 0) {