mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-24 10:17:39 +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
|
* @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;
|
* Construct the object;
|
||||||
@ -103,15 +87,16 @@ public class WorldEditPlayerListener extends PlayerListener {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
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());
|
LocalWorld world = new BukkitWorld(event.getClickedBlock().getWorld());
|
||||||
WorldVector pos = new WorldVector(world, event.getClickedBlock().getX(),
|
WorldVector pos = new WorldVector(world, event.getClickedBlock().getX(),
|
||||||
event.getClickedBlock().getY(), event.getClickedBlock().getZ());
|
event.getClickedBlock().getY(), event.getClickedBlock().getZ());
|
||||||
LocalPlayer player = wrapPlayer(event.getPlayer());
|
LocalPlayer player = wrapPlayer(event.getPlayer());
|
||||||
|
|
||||||
if (plugin.getWorldEdit().handleBlockLeftClick(player, pos)) {
|
if (!(event.getAction() == Action.LEFT_CLICK_BLOCK && plugin.getWorldEdit().handleBlockLeftClick(player, pos))) {
|
||||||
event.setCancelled(true);
|
plugin.getWorldEdit().handleArmSwing(localPlayer);
|
||||||
}
|
}
|
||||||
|
event.setCancelled(true);
|
||||||
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
LocalWorld world = new BukkitWorld(event.getClickedBlock().getWorld());
|
LocalWorld world = new BukkitWorld(event.getClickedBlock().getWorld());
|
||||||
WorldVector pos = new WorldVector(world, event.getClickedBlock().getX(),
|
WorldVector pos = new WorldVector(world, event.getClickedBlock().getX(),
|
||||||
|
@ -138,7 +138,6 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this);
|
PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this);
|
||||||
|
|
||||||
registerEvent(Event.Type.PLAYER_QUIT, playerListener);
|
registerEvent(Event.Type.PLAYER_QUIT, playerListener);
|
||||||
registerEvent(Event.Type.PLAYER_ANIMATION, playerListener);
|
|
||||||
registerEvent(Event.Type.PLAYER_INTERACT, playerListener);
|
registerEvent(Event.Type.PLAYER_INTERACT, playerListener);
|
||||||
registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener);
|
registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener);
|
||||||
registerEvent(Event.Type.PLAYER_JOIN, criticalPlayerListener, Priority.Lowest);
|
registerEvent(Event.Type.PLAYER_JOIN, criticalPlayerListener, Priority.Lowest);
|
||||||
|
Loading…
Reference in New Issue
Block a user