mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-22 08:29:20 +00:00
Fixed 2 NPE errors
This commit is contained in:
@@ -148,6 +148,10 @@ public class AttackListeners extends PluginDependent implements Listener {
|
|||||||
|
|
||||||
LivingEcoBoss livingEcoBoss = boss.getLivingBoss(entity);
|
LivingEcoBoss livingEcoBoss = boss.getLivingBoss(entity);
|
||||||
|
|
||||||
|
if (livingEcoBoss == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
livingEcoBoss.handleAttack(player);
|
livingEcoBoss.handleAttack(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.willfp.ecobosses.bosses.LivingEcoBoss;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -34,7 +35,14 @@ public class AutoSpawnTimer implements Runnable {
|
|||||||
Set<World> worlds = new HashSet<>();
|
Set<World> worlds = new HashSet<>();
|
||||||
|
|
||||||
for (UUID uuid : boss.getLivingBosses().keySet()) {
|
for (UUID uuid : boss.getLivingBosses().keySet()) {
|
||||||
worlds.add(Bukkit.getEntity(uuid).getWorld());
|
Entity entity = Bukkit.getEntity(uuid);
|
||||||
|
|
||||||
|
if (entity == null) {
|
||||||
|
boss.removeLivingBoss(uuid);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
worlds.add(entity.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Location> locations = new ArrayList<>(boss.getAutoSpawnLocations());
|
List<Location> locations = new ArrayList<>(boss.getAutoSpawnLocations());
|
||||||
|
|||||||
Reference in New Issue
Block a user