Fix the detection of dead entities not being removed

This commit is contained in:
filoghost 2020-04-13 15:54:10 +02:00
parent d78414c30e
commit 7e68239263

View File

@ -21,9 +21,11 @@ import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import com.gmail.filoghost.holographicdisplays.HolographicDisplays;
import com.gmail.filoghost.holographicdisplays.api.Hologram;
@ -59,7 +61,8 @@ public class DebugCommand extends HologramSubCommand {
for (World world : Bukkit.getWorlds()) {
Map<Hologram, HologramDebugInfo> hologramsDebugInfo = new HashMap<>();
for (Entity entity : world.getEntities()) {
for (Chunk chunk : world.getLoadedChunks()) {
for (Entity entity : chunk.getEntities()) {
NMSEntityBase nmsEntity = HolographicDisplays.getNMSManager().getNMSEntityBase(entity);
if (nmsEntity == null) {
@ -75,6 +78,7 @@ public class DebugCommand extends HologramSubCommand {
hologramDebugInfo.aliveEntities++;
}
}
}
if (!hologramsDebugInfo.isEmpty()) {
foundAnyHologram = true;