Remove unnecessary player animation event, just use player interact instead

Dieser Commit ist enthalten in:
mrapple 2011-07-23 10:51:31 -05:00
Ursprung 2952423e78
Commit 15b97782c4
2 geänderte Dateien mit 6 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -46,22 +46,6 @@ public class WorldEditPlayerListener extends PlayerListener {
*
* @param event Relevant event details
*/
@Override
public void onPlayerAnimation(PlayerAnimationEvent event) {
LocalPlayer localPlayer = wrapPlayer(event.getPlayer());
if (event.getAnimationType() == PlayerAnimationType.ARM_SWING) {
plugin.getWorldEdit().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.getWorldEdit().handleBlockLeftClick(localPlayer, pt)) {
}
}
}
/**
* Construct the object;
@ -103,15 +87,16 @@ public class WorldEditPlayerListener extends PlayerListener {
*/
@Override
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR) {
LocalWorld world = new BukkitWorld(event.getClickedBlock().getWorld());
WorldVector pos = new WorldVector(world, event.getClickedBlock().getX(),
event.getClickedBlock().getY(), event.getClickedBlock().getZ());
LocalPlayer player = wrapPlayer(event.getPlayer());
if (plugin.getWorldEdit().handleBlockLeftClick(player, pos)) {
event.setCancelled(true);
if (!(event.getAction() == Action.LEFT_CLICK_BLOCK && plugin.getWorldEdit().handleBlockLeftClick(player, pos))) {
plugin.getWorldEdit().handleArmSwing(localPlayer);
}
event.setCancelled(true);
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
LocalWorld world = new BukkitWorld(event.getClickedBlock().getWorld());
WorldVector pos = new WorldVector(world, event.getClickedBlock().getX(),

Datei anzeigen

@ -138,7 +138,6 @@ public class WorldEditPlugin extends JavaPlugin {
PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this);
registerEvent(Event.Type.PLAYER_QUIT, playerListener);
registerEvent(Event.Type.PLAYER_ANIMATION, playerListener);
registerEvent(Event.Type.PLAYER_INTERACT, playerListener);
registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener);
registerEvent(Event.Type.PLAYER_JOIN, criticalPlayerListener, Priority.Lowest);