summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-01-17 15:52:02 -0600
committerEvilSeph <evilseph@gmail.com>2012-01-23 23:59:36 -0500
commit74ead3abd17c4dfb0987a143483b2ca68ce1553f (patch)
tree46744c12b5275ad741ca05483b36433337d0432c
parentcf521b5a5ca399e807f05f7ba3fd12bc3e160875 (diff)
downloadcraftbukkit-74ead3abd17c4dfb0987a143483b2ca68ce1553f.tar
craftbukkit-74ead3abd17c4dfb0987a143483b2ca68ce1553f.tar.gz
craftbukkit-74ead3abd17c4dfb0987a143483b2ca68ce1553f.tar.lz
craftbukkit-74ead3abd17c4dfb0987a143483b2ca68ce1553f.tar.xz
craftbukkit-74ead3abd17c4dfb0987a143483b2ca68ce1553f.zip
Immediately tell client a block is broken, then process the event.
In order to avoid clients seeing blocks break, reappear, then break again due to lag caused by plugins taking too long to process the BlockBreakEvent we immediately tell the client the block is air then process the event. If the event ends up being cancelled the client will get another packet telling them the block still exists.
-rw-r--r--src/main/java/net/minecraft/server/ItemInWorldManager.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java
index 663489fc..322d58fd 100644
--- a/src/main/java/net/minecraft/server/ItemInWorldManager.java
+++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java
@@ -203,6 +203,16 @@ public class ItemInWorldManager {
if (this.player instanceof EntityPlayer) {
org.bukkit.block.Block block = this.world.getWorld().getBlockAt(i, j, k);
+ // Tell client the block is gone immediately then process events
+ if (world.getTileEntity(i, j, k) == null) {
+ int id = block.getTypeId();
+ byte data = block.getData();
+
+ block.setTypeId(0, false);
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ block.setTypeIdAndData(id, data, false);
+ }
+
BlockBreakEvent event = new BlockBreakEvent(block, (org.bukkit.entity.Player) this.player.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);