mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-01-03 21:28:22 +00:00
Fix possible null pointer when shooting arrows into portals
This commit is contained in:
parent
e712532b58
commit
2059b902a2
1 changed files with 2 additions and 2 deletions
|
@ -27,7 +27,7 @@ public class ParticleStyleArrows implements ParticleStyle, Listener {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = this.arrows.size() - 1; i >= 0; i--) { // Loop backwards so the last-fired arrows are the ones that have particles if they go over the max
|
for (int i = this.arrows.size() - 1; i >= 0; i--) { // Loop backwards so the last-fired arrows are the ones that have particles if they go over the max
|
||||||
Projectile arrow = this.arrows.get(i);
|
Projectile arrow = this.arrows.get(i);
|
||||||
if (((Player) arrow.getShooter()).getUniqueId().equals(particle.getOwnerUniqueId())) {
|
if (arrow.getShooter() != null && ((Player) arrow.getShooter()).getUniqueId().equals(particle.getOwnerUniqueId())) {
|
||||||
particles.add(new PParticle(arrow.getLocation(), 0.05F, 0.05F, 0.05F, 0.0F));
|
particles.add(new PParticle(arrow.getLocation(), 0.05F, 0.05F, 0.05F, 0.0F));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class ParticleStyleArrows implements ParticleStyle, Listener {
|
||||||
public void updateTimers() {
|
public void updateTimers() {
|
||||||
for (int i = this.arrows.size() - 1; i >= 0; i--) {
|
for (int i = this.arrows.size() - 1; i >= 0; i--) {
|
||||||
Projectile arrow = this.arrows.get(i);
|
Projectile arrow = this.arrows.get(i);
|
||||||
if (arrow.getTicksLived() >= 1200 || arrow.isDead() || !arrow.isValid())
|
if (arrow.getTicksLived() >= 1200 || arrow.isDead() || !arrow.isValid() || arrow.getShooter() == null)
|
||||||
this.arrows.remove(i);
|
this.arrows.remove(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue