mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-11-01 09:59:18 +00:00
playeranimation event fires at least 2 times if not 3 when doing one left click on a block due to minecraft being weird like that. this should keep previous behavior but only run once when left clicking either the air or a block
This commit is contained in:
parent
4d9cf70ea8
commit
e09ea94629
|
@ -1415,9 +1415,18 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerSwing(final PlayerAnimationEvent event) {
|
public void onPlayerSwing(final PlayerInteractEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
if (event.getHand() != EquipmentSlot.HAND) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_AIR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK && event.isCancelled()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue