I have a DataHolders
class.
It contains:
public static boolean hit;
In my other class theres:
public void onHit(ProjectileHitEvent event) {
if (event.getHitEntity() != null || event.getHitBlock() != null) {
DataHolders.hit = true;
}
}
ProjectileHitEvent
gets triggered when a Player hits something with a Projectile (Arrow)
In my last class:
public void onLaunch(ProjectileLaunchEvent event) {
while (!DataHolders.hit) {
//..............
}
}
ProjectileLaunchEvent
gets triggered when a Player launches the Projectile (Arrow)
I want to do something while the Projectile (Arrow) is in the air (ProjectileLaunchEvent
triggered but ProjectileHitEvent
not).
But when the Arrow hits something (ProjectileHitEvent
gets triggered and boolean hit
becomes true
) the loop should stop but the while loop goes on. I've already tested if ProjectileHitEvent
really gets triggered, it works but the loop doesn't.