9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-21 16:09:24 +00:00

Fixed 2 NPE errors

This commit is contained in:
Auxilor
2021-06-10 11:04:28 +01:00
parent 87095166d0
commit 98faf823ba
2 changed files with 13 additions and 1 deletions

View File

@@ -148,6 +148,10 @@ public class AttackListeners extends PluginDependent implements Listener {
LivingEcoBoss livingEcoBoss = boss.getLivingBoss(entity);
if (livingEcoBoss == null) {
return;
}
livingEcoBoss.handleAttack(player);
}

View File

@@ -8,6 +8,7 @@ import com.willfp.ecobosses.bosses.LivingEcoBoss;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import java.util.ArrayList;
import java.util.HashSet;
@@ -34,7 +35,14 @@ public class AutoSpawnTimer implements Runnable {
Set<World> worlds = new HashSet<>();
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());