Don't process cancelled projectile spawns

This fixes a bug caused by an edge-case in which an explosive arrow's particles lingered forever when an explosive crossbow was fired from a chunk that is at/exceeds the entity limit.

Extras cancels the EntitySpawnEvent to enforce its entity limit; which does not call EntityRemoveFromWorldEvent on cancellation, thus causing this issue.
This commit is contained in:
Allink 2023-02-24 19:19:38 +00:00
parent 55eb4d62ad
commit 07b830470d
No known key found for this signature in database

View file

@ -34,8 +34,12 @@ public final class WeaponExplosiveCrossbow implements Listener {
private final List<Projectile> explosiveProjectiles = new ArrayList<>();
private final SecureRandom secureRandom = new SecureRandom();
@EventHandler
@EventHandler(priority = EventPriority.MONITOR)
public void onShootArrow(ProjectileLaunchEvent event) {
if (event.isCancelled()) {
return;
}
final Projectile projectile = event.getEntity();
final ProjectileSource source = projectile.getShooter();