From 2ccbcacfc2550d85eb889a34c26d0997192a0075 Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 24 Feb 2011 17:14:03 -0800 Subject: [PATCH] Added a workaround to the fact that Minecraft no longer sends a block dig packet for bedrock. --- .../worldedit/bukkit/WorldEditPlayerListener.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java index 8fa2ed9b4..299d7f4cd 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java @@ -26,6 +26,9 @@ import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerListener; +import com.sk89q.worldedit.LocalPlayer; +import com.sk89q.worldedit.WorldVector; +import com.sk89q.worldedit.blocks.BlockID; /** * Handles all events thrown in relation to a Player @@ -43,8 +46,18 @@ public class WorldEditPlayerListener extends PlayerListener { */ @Override public void onPlayerAnimation(PlayerAnimationEvent event) { + LocalPlayer localPlayer = wrapPlayer(event.getPlayer()); + if (event.getAnimationType() == PlayerAnimationType.ARM_SWING) { - plugin.controller.handleArmSwing(wrapPlayer(event.getPlayer())); + plugin.controller.handleArmSwing(localPlayer); + } + + // As of Minecraft 1.3, a block dig packet is no longer sent for + // bedrock, so we have to do an (inaccurate) detection ourself + WorldVector pt = localPlayer.getBlockTrace(5); + if (pt != null && pt.getWorld().getBlockType(pt) == BlockID.BEDROCK) { + if (plugin.controller.handleBlockLeftClick(localPlayer, pt)) { + } } }