mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Remove unnecessary player animation event, just use player interact instead
This commit is contained in:
parent
2952423e78
commit
15b97782c4
@ -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(),
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user