xNuminousx
Verified Member
This is the listener for a SneakEvent:
For my move, the progress is getting the location of the player when they press shift initially. I have a check for an animation to play when they release shift, however when they release shift the animation plays where they initially pressed shift. Here's a scenario.
Player A holds shift in Location 1. While charging the move, Player A moves to Location 2, however when Player A releases shift to launch the ability, the move is launched at Location 1 rather than in Location 2 where the player released shift.
Do I need an area in the listener to say "Get the location when the player holds shift, then update it when they release shift" because I swear I've tried hundreds of solutions, even gave Emerald full access to my ability for help, and it's not working.
Here's the area of code I'm talking about if this helps. If the issue could reside in my animation area (As in the animation is getting the location of a tap shift rather than release shift) then I'll message someone. I want this move to be a surprise and that means keeping it on the DL o_o
Code:
@EventHandler
public void onSwing(PlayerToggleSneakEvent event) {
if (event.isCancelled()) {
return;
Player A holds shift in Location 1. While charging the move, Player A moves to Location 2, however when Player A releases shift to launch the ability, the move is launched at Location 1 rather than in Location 2 where the player released shift.
Do I need an area in the listener to say "Get the location when the player holds shift, then update it when they release shift" because I swear I've tried hundreds of solutions, even gave Emerald full access to my ability for help, and it's not working.
Here's the area of code I'm talking about if this helps. If the issue could reside in my animation area (As in the animation is getting the location of a tap shift rather than release shift) then I'll message someone. I want this move to be a surprise and that means keeping it on the DL o_o
Code:
if (player.isSneaking()) {
chargeAnimation();
if ((!isCharged) && (System.currentTimeMillis() > currTime + 7000)) {
isCharged = true;
}
}
if (!player.isSneaking()) {
if (isCharged) {
direction = player.getEyeLocation().getDirection().normalize();
blast();
bPlayer.addCooldown(this);
}
}